-
Notifications
You must be signed in to change not 8000 ification settings - Fork 451
Adding custom thread names to component_container_isolated #2818
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
Comments
I second this. With Linux 'pthread' the character limit is 16, I believe also the null terminating character is included in this count. I personally truncate the node name (no namespaces) to length 15. This could create ambiguities if multiple nodes share the same 15-char name prefix... I would suggest to print in debug logs the full mapping between node (namespace+name) and assigned thread name. Maybe "wasting" the initial 2-3 chars to prepend a sequential number would be a trade-off to consider IMHO. |
it could be useful for frontend monitoring tool, but what if |
I suppose even if you are using multi threaded executor, each component will have an isolated thread pool, correct? So it could still be helpful to just have all of the threads in a components pool be named after the node. |
yes, but we need to update the MultiThreadedExecutor class to allow the application to change the names of all threads of it. we can control the main thread, but not all child threads created by MultiThreadedExecutor class.
are you suggesting that all the child thread in the MultiThreadedExecutor should inherit the same name from main thread of that? |
I think so, because then at least different components with their own executors would have differently named threads from each other. |
At a weekly ROS 2 issues triage meeting, we agreed that yes, it makes sense to add it. However, help wanted here with implementation. |
I can take a try at this. |
Description
Since component_container_isolated spins up a thread for each node, it would be nice to name those threads in a way that operating system tools can identify them easily. This would involve writing code that uses the platform-specific API's with conditional compilation that sets the thread name at the beginning.
Motivation
Identify resource usage quickly by node using tools like htop, system monitor, task manager, etc.
Design / Implementation Considerations
I think it would be best to use the fully qualified node name, but with namespaces, this could quickly get longer than the character limit for thread names, and would require truncation. So it might be better to do just the node name itself, or maybe some kind of identifier, maybe just an index, that could be logged with debug logs?
Additional Information
No response
The text was updated successfully, but these errors were encountered: