RFR: 8314091: Set native thread name for Java main thread

David Holmes dholmes at openjdk.org
Thu Aug 10 21:19:58 UTC 2023


On Thu, 10 Aug 2023 12:42:10 GMT, Yi Yang <yyang at openjdk.org> wrote:

> `cat /proc/<java_process>/task/<main thread>/comm` shows "java"
> 
> User wants it to be "main", just like any other JVM threads, which can be achieved by explicitly calling pthread_setname_np when spawning main thread at VM startup.

I do not agree with this change.

It is a policy decision that the native thread names of attached native threads are not changed by the VM - this includes the initial/starting thread that loads the VM - as those threads belong to the application loading the VM. If it were  desirable to make this kind of change then it would have to happen in the launcher as then we know that we "own" the initial thread.

<deleted incorrect comment about name of primordial thread>

-------------

Changes requested by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/15224#pullrequestreview-1572738535


More information about the hotspot-runtime-dev mailing list