visualvm
visualvm copied to clipboard
Tab 'Threads' doesn't refresh thread names and thread renamings.
Describe the bug In threads list in tab 'Threads' threads that have been renamed do not change their names after they had been initially displayed in list.
To Reproduce Steps to reproduce the behavior:
- Write simple application with main(args) method
- Start some thread pool with named thread factory setting some %yourPrefix% for thread names and run some tasks to populate pool with threads.
- Open VisualVM and go to tab 'threads'. Threads named with the prefix provided in thread factory in step 3 are present in list .
- do following thing with your executor: executor.execute(() -> Thread.currentThread().setName(%anotherName%));
- Return to VisualVM threads list. Name change %yourPrefix% -> %anotherName% would not be displayed in list. As a matter of fact, thread renaming is done, but VisualVM have not refreshed the list. In order to see renaming result, close this particular JVM tab and open it again - new thread name is visible.
Expected behavior It is expected that thread renaming effect will be displayed in threads list after Thread.setName() invocation.
Desktop (please complete the following information):
- OS: Windows 10
- JDK version: 1.8.0_65
- Version: 1.4.3
For reference, I find thread renaming very helpful for debugging. Every time I get a worker from a thread pool I rename it to indicate what kind of task it is working on. When the task is complete I restore the original name.
+1 our app uses thread pooling but when a worker thread picks up a task the thread name changes to reflect the account / task type. it is useful for debugging
It’s a bug with visualvm and must be fixed. I want to put and updating debugging info to thread names, but visualvm doesn't update it after first load.