JDK-8314091 : Set native thread name for Java main thread
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 22
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2023-08-10
  • Updated: 2023-08-11
Related Reports
Relates :  
Description
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.


Comments
Previously proposed and rejected in JDK-8152690 - there are additional complexities here.
11-08-2023

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.
10-08-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15224 Date: 2023-08-10 12:42:10 +0000
10-08-2023