You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/**
* Special child of the system thread group for running tasks that
* may execute user code. The need for a separate thread group may
* be a vestige of it having had a different security policy from
* the system thread group, so this might no longer be necessary.
*/
private static final ThreadGroup userThreadGroup =
new ThreadGroup(systemThreadGroup, "RMI Runtime");
/**
* Accepts connections from the server socket and executes
* handlers for them in the thread pool.
**/
private void executeAcceptLoop() {
if (tcpLog.isLoggable(Log.BRIEF)) {
tcpLog.log(Log.BRIEF, "listening on port " +
getEndpoint().getPort());
}
while (true) {
Socket socket = null;
try {
socket = serverSocket.accept();
/*
* Find client host name (or "0.0.0.0" if unknown)
*/
InetAddress clientAddr = socket.getInetAddress();
String clientHost = (clientAddr != null
? clientAddr.getHostAddress()
: "0.0.0.0");
/*
* Execute connection handler in the thread pool,
* which uses non-system threads.
*/
try {
connectionThreadPool.execute(
new ConnectionHandler(socket, clientHost));
In this context I have 2 issues with JDT debug:
To debug LSP code, I had to enable system threads. System threads are not shown per default so I was wondering what is going on until I thought to enable "show system threads" in the Debug view.
While debugging LSP code that is triggered by LSP4J, I've noticed that the threads which service LSP requests are considered system threads.
They are under the "RMI Runtime" thread group, defined here: https://github.com/openjdk/jdk/blob/10af769eb06427e37ae943a21964ae51de4526c6/src/java.rmi/share/classes/sun/rmi/runtime/RuntimeUtil.java#L76
Threads created with this group are called user threads by the JDK: https://github.com/openjdk/jdk/blob/10af769eb06427e37ae943a21964ae51de4526c6/src/java.rmi/share/classes/sun/rmi/runtime/RuntimeUtil.java#L182
Such threads seem to be created to service TCP socket communication: https://github.com/openjdk/jdk/blob/10af769eb06427e37ae943a21964ae51de4526c6/src/java.rmi/share/classes/sun/rmi/transport/tcp/TCPTransport.java#L101
See: https://github.com/openjdk/jdk/blob/10af769eb06427e37ae943a21964ae51de4526c6/src/java.rmi/share/classes/sun/rmi/transport/tcp/TCPTransport.java#L356-L385
In this context I have 2 issues with JDT debug:
So my question is, should we consider threads in the group "RMI Runtime" to not be system threads? Considering JDK code calls them user threads?
Currently we have this in
JDIThread:eclipse.jdt.debug/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java
Line 547 in 8623659
The main thread group being:
eclipse.jdt.debug/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java
Line 114 in 8623659
Should we add a 2nd constant for "RMI Runtime" and use that as well, to determine if a thread is a system thread?