apache / apache/netbeans

Thread dumps don't work in profiler

Open
#8,039 2 comments 0 reactions 0 assignees View on GitHub
Java kind:bug needs:triage profiler
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 23

### What happened

Clicked "Take thread dump from the profiled process" button, got this error:
```
Exception in thread "*** Profiler Agent Communication Thread" java.lang.RuntimeException: java.lang.IllegalAccessException: class org.netbeans.lib.profiler.server.system.ThreadDump cannot access class sun.management.ThreadInfoCompositeData (in module java.management) because module java.management does not export sun.management to unnamed module @6b884d57
at org.netbeans.lib.profiler.server.system.ThreadDump.toCompositeData(ThreadDump.java:85)
at org.netbeans.lib.profiler.server.system.ThreadDump.takeThreadDump(ThreadDump.java:71)
at org.netbeans.lib.profiler.server.ProfilerServer.handleClientCommand(ProfilerServer.java:1664)
at org.netbeans.lib.profiler.server.ProfilerServer.listenToClient(ProfilerServer.java:1753)
at org.netbeans.lib.profiler.server.ProfilerServer.run(ProfilerServer.java:676)
Caused by: java.lang.IllegalAccessException: class org.netbeans.lib.profiler.server.system.ThreadDump cannot access class sun.management.ThreadInfoCompositeData (in module java.management) because module java.management does not export sun.management to unnamed module @6b884d57
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674)
at java.base/java.lang.reflect.Method.invoke(Method.java:560)
at org.netbeans.lib.profiler.server.system.ThreadDump.toCompositeData(ThreadDump.java:83)
... 4 more
```
Tried with NetBeans 18 as well, same result.

### Language / Project Type / NetBeans Component

Java Maven project

### How to reproduce

1. Generated the calibration pack for Linux x64 on Netbeans Windows 10
2. Placed the pack into an application running on Docker with a WSL 2 Ubuntu backend
3. Profiler successfully connected to the application on localhost
4. Tried to take a thread dump

### Did this work correctly in an earlier version?

Apache NetBeans 16 or earlier

### Operating System

WSL 2 Ubuntu / Win 10

### JDK

17

### Apache NetBeans packaging

Apache NetBeans provided installer

### Anything else

_No response_

### Are you willing to submit a pull request?

No

Contributor guide

Open the contributing guide

Research direction

Start with lib.profiler.server.system.ThreadDump, especially toCompositeData at the reported lines, and trace how ProfilerServer.handleClientCommand invokes takeThreadDump. Reproduce the thread-dump action with the described NetBeans, JDK 17, and WSL setup; done means the dump completes without the reported IllegalAccessException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.