-
Notifications
You must be signed in to change notification settings - Fork 851
Show running thread in async registry #21776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
arangod/AsyncRegistryServer/PrettyPrinter/src/asyncregistry/gdb_data.py
Outdated
Show resolved
Hide resolved
arangod/AsyncRegistryServer/PrettyPrinter/src/pretty-printer.py
Outdated
Show resolved
Hide resolved
lib/Containers/Concurrent/thread.h
Outdated
@@ -36,8 +36,7 @@ struct ThreadId { | |||
}; | |||
template<typename Inspector> | |||
auto inspect(Inspector& f, ThreadId& x) { | |||
return f.object(x).fields(f.field("LWPID", x.kernel_id), | |||
f.field("name", x.name())); | |||
return f.object(x).fields(f.field("LWPID", x.kernel_id)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a situation where having the posix_id
in addition to kernel_id
might be helpful to know while we don't have the name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understood, the posix id does not provide more information, but it can act as a handle to do more stuff with it via the posix API, e.g. get the thread name yourself. The lwpid is just a low level thread id of the kernel. So perhaps it can be useful to additionally have the posix id as well. I'll add it back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine by me without it, it really was an open question. The cases I can think of I'd like to see the LWPID, and can't think of something where I'd need the posix_id.
Arangod crashed after requesting the async registry, due to a bug: When reading the registry, every promise inside it requests the thread name of its owning thread in order to print that name. The problem is that this owning thread does not need to exist any more although the promise still exists, e.g. because the promise was suspended (so is currently not running at all) or resumed on another thread. So when requesting the thread name of a thread that does not exist any more, we crash.
Actually, the owning thread is not interesting for the user, the user just wants to see on which thread the promise is currently running (if it is running). Therefore, this PR adds a running_thread member to the promise and updates it when a state change occurs: if the state is running, then the promise has a running thread, otherwise the promise has no running thread.
The PR also updates the pretty printers of the async registry.