Skip to content
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

Tab 'Threads' doesn't refresh thread names and thread renamings. #159

Open
Diarsid opened this issue Oct 8, 2019 · 3 comments
Open

Tab 'Threads' doesn't refresh thread names and thread renamings. #159

Diarsid opened this issue Oct 8, 2019 · 3 comments

Comments

@Diarsid
Copy link

Diarsid commented Oct 8, 2019

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:

  1. Write simple application with main(args) method
  2. Start some thread pool with named thread factory setting some %yourPrefix% for thread names and run some tasks to populate pool with threads.
  3. Open VisualVM and go to tab 'threads'. Threads named with the prefix provided in thread factory in step 3 are present in list .
  4. do following thing with your executor:
    executor.execute(() -> Thread.currentThread().setName(%anotherName%));
  5. 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
@cowwoc
Copy link

cowwoc commented Aug 9, 2022

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.

@mbigatti
Copy link

mbigatti commented Sep 9, 2022

+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

@JayDi85
Copy link

JayDi85 commented Dec 2, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants