Skip to content

reef: log: save/fetch thread name infra - #60728

Merged
mchangir merged 6 commits into
ceph:reeffrom
mchangir:wip-68651-reef
Nov 26, 2024
Merged

mchangir merged 6 commits into
ceph:reeffrom
mchangir:wip-68651-reef

Conversation

* pthread name is saved in a thread_local storage
* the thread_local name is copied into Entry object's ctor
* Log::dump_recent() reads the thread name from the Entry
  object's data member when dumping logs

Fixes: https://tracker.ceph.com/issues/50743
Signed-off-by: Milind Changire <[email protected]>
(cherry picked from commit 0be8d01)
@mchangir mchangir added this to the reef milestone Nov 14, 2024
This provides common ceph entrypoints for the pthread_[gs]name functions which
will also cache a thread_local copy. This also removes the pthread_t parameter
which precipitated the bug i50743.

Obviously, the overall goal here is to avoid system calls.

Conflicts:
	src/ceph_nvmeof_monitor_client.cc (not available in reef)
	src/common/ceph_timer.h
	src/include/compat.h
	src/mds/Beacon.cc
	src/rgw/driver/rados/rgw_notify.cc
	src/rgw/rgw_lua_background.cc (not available in reef)

See-also: https://tracker.ceph.com/issues/50743
Fixes: 0be8d01
Fixes: https://tracker.ceph.com/issues/68691
Signed-off-by: Patrick Donnelly <[email protected]>
(cherry picked from commit 7de5af5)
Signed-off-by: Milind Changire <[email protected]>
In general, a pthread implementation reuses thread ids routinely so the
circular_buffer is there to help us see what the thread name was historically
(capped at 4 entries).

However, to guard against this map from growing without bound, discard entries
that are more than a day old. This would happen if a thread logged an Entry and
has since disappeared for more than a day.

Signed-off-by: Patrick Donnelly <[email protected]>
(cherry picked from commit bfe489e)
Signed-off-by: Milind Changire <[email protected]>
To be consistent and sensical.

Signed-off-by: Patrick Donnelly <[email protected]>
(cherry picked from commit a2a989a)
Signed-off-by: Milind Changire <[email protected]>

Conflicts:
	src/mds/MDLog.cc (no upkeep thread in reef)
	src/mds/QuiesceAgent.h (not available in reef)
	src/mds/QuiesceDbManager.cc (not available in reef)
Since ceph_pthread_setname() has now been moved from a macro to a
function, we need to reference the common library to link it to.

Signed-off-by: Milind Changire <[email protected]>
@mchangir

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@mchangir

Copy link
Copy Markdown
Contributor Author

jenkins test api

2 similar comments
@mchangir

Copy link
Copy Markdown
Contributor Author

jenkins test api

@mchangir

Copy link
Copy Markdown
Contributor Author

jenkins test api

@mchangir

Copy link
Copy Markdown
Contributor Author

@batrick please take a look

@mchangir mchangir added the wip-mchangir-testing not yet production ready label Nov 22, 2024
@mchangir

Copy link
Copy Markdown
Contributor Author

@mchangir

Copy link
Copy Markdown
Contributor Author

@mchangir

Copy link
Copy Markdown
Contributor Author

In one of the MDS logs:
/teuthology/mchangir-2024-11-23_03:19:56-fs-wip-mchangir-testing-20241122.051535-reef-debug-testing-default-smithi/8005117/remote/smithi017/log/cce91c9c-a950-11ef-bba1-d5e06f7e0c9a/ceph-mds.cephfs.smithi017.eitakp.log.gz

--- pthread ID / name mapping for recent threads ---
  7fba54ed2640 / 
  7fba556d3640 / md_submit
  7fba55ed4640 / 
  7fba566d5640 / MR_Finisher
  7fba586d9640 / ms_dispatch
  7fba5a6dd640 / ceph-mds
  7fba5aede640 / safe_timer
  7fba5b6df640 / safe_timer
  7fba5c6e1640 / ms_dispatch
  7fba5cee2640 / io_context_pool
  7fba5d6e3640 / io_context_pool
  7fba5e6e5640 / admin_socket
  7fba5eee6640 / msgr-worker-2
  7fba5f6e7640 / msgr-worker-1
  7fba5fee8640 / msgr-worker-0
  7fba60f4c800 / ceph-mds
  max_recent     10000
  max_new         1000
  log_file /var/log/ceph/ceph-mds.cephfs.smithi017.eitakp.log
--- end dump of recent events ---

In the above list, the following thread IDs have no names:

  7fba54ed2640 / <--- seems to be _replay_thread
  7fba55ed4640 / <--- seems to be Messenger Thread

@batrick please see if this is concerning

@batrick

batrick commented Nov 25, 2024

Copy link
Copy Markdown
Member

It's an upgrade test from quincy (which doesn't have this change)?

@mchangir

Copy link
Copy Markdown
Contributor Author

It's an upgrade test from quincy (which doesn't have this change)?

thanks

@vshankar please approve and merge PR ... tests do not show any crashes

@mchangir
mchangir merged commit 198572a into ceph:reef Nov 26, 2024
Comment on lines -509 to +510
if (const auto rc = ceph_pthread_setname(workers.back().native_handle(),
thread_name.c_str()); rc != 0) {
if (const auto rc = ceph_pthread_setname(thread_name.c_str()); rc != 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we tracking any regressions from this change?

from rgw bug report https://tracker.ceph.com/issues/71044:

Since radosgw 18.2.5 the basename of the radosgw process is set to notif-worker0 instead of radosgw

this backport was new in 18.2.5. somehow this notif-worker0 string is ending up as the process name?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also appear to be getting crash dumps that refer to thread_name:notif-worker0:

2025-04-25T06:04:01.563+0000 7f1b64491640 -1 *** Caught signal (Aborted) **
 in thread 7f1b64491640 thread_name:notif-worker0

but are not actually happening on this thread

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7de5af5#diff-e05836df60adf79bd9d629146b894bcd2ac828ea23a63c324e87b20cf7650d72L21-R786

The cherry-pick of that commit seems to have dropped changes in this PR as part of conflict resolution. That's probably the bug.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mchangir @batrick how would you like to track this regression?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants