JDK-7188890 : Linux: set OS thread title for created threads
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 8
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: generic
  • Submitted: 2012-08-02
  • Updated: 2013-03-26
  • Resolved: 2013-03-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Description
This is a SUNBUG for https://bugs.openjdk.java.net/show_bug.cgi?id=100127

Description From Stepan K:

Created an attachment (id=172) [details]
The patch

syscall

prctl(PR_SET_NAME, "title")

sets OS thread name in Linux, that can be later inspected by command

ps -L -p <jvm-pid>

I propose setting thread name to ThreadType for threads created by JVM. This
can be useful to understand what JVM does, and to diagnose and resolve
problems.

Sample output:

===
[nga@garden:~/devel/left/jdk7]% ps -L -p 1758
  PID   LWP TTY          TIME CMD
 1758  1758 pts/4    00:00:00 java
 1758  1759 pts/4    00:00:00 java
 1758  1760 pts/4    00:00:00 pgc
 1758  1761 pts/4    00:00:00 pgc
 1758  1762 pts/4    00:00:00 pgc
 1758  1763 pts/4    00:00:00 pgc
 1758  1764 pts/4    00:00:00 pgc
 1758  1765 pts/4    00:00:00 pgc
 1758  1766 pts/4    00:00:00 pgc
 1758  1767 pts/4    00:00:00 pgc
 1758  1768 pts/4    00:00:00 vm
 1758  1769 pts/4    00:00:00 rjava
 1758  1770 pts/4    00:00:00 rjava
 1758  1771 pts/4    00:00:00 rjava
 1758  1772 pts/4    00:00:00 compiler
 1758  1773 pts/4    00:00:00 compiler
 1758  1774 pts/4    00:00:00 rjava
 1758  1775 pts/4    00:00:00 watcher
===

Patch attached.

Comments
Updating hs30 -> hs25 to reflect version number of HotSpot going into JDK8.
26-10-2012

PUBLIC COMMENTS There is already a proposal to expand the Thread.setName support to set the native thread name on Linux (should also extend to solaris et al) - at present it is only on OSX (was added by the Mac Port under protest due to lack of cross platform support). That proposal is based on the non-portable pthread_setname_np call. As discussed on here: http://mail.openjdk.java.net/pipermail/hotspot-dev/2012-July/006211.html the proposal is not without problems.
05-08-2012