maintainer-feedback requested: [Bug 223589] [PATCH] java/openjdk8: support setting thread name in OpenJDK8

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Nov 10 08:35:15 UTC 2017


bra at fsn.hu has reassigned Bugzilla Automation <bugzilla at FreeBSD.org>'s request
for maintainer-feedback to java at FreeBSD.org:
Bug 223589: [PATCH] java/openjdk8: support setting thread name in OpenJDK8
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223589



--- Description ---
Created attachment 187902
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=187902&action=edit
openjdk8 thread name patch

The following patch makes OpenJDK8 able to set threads' native name, which is
quite useful for debugging which thread uses resources.
Before the patch you can see this in top:
43720 tomcat	     20    0 11563M  9233M kqread  7   1:12   0.45% java{java}
43720 tomcat	     20    0 11563M  9233M kqread  8   1:17   0.45% java{java}
43720 tomcat	     20    0 11563M  9233M kqread  5   1:09   0.44% java{java}
43720 tomcat	     20    0 11563M  9233M kqread 15   1:19   0.44% java{java}
43720 tomcat	     20    0 11563M  9233M kqread 16   0:58   0.44% java{java}
43720 tomcat	     20    0 11563M  9233M kqread  6   1:15   0.44% java{java}
43720 tomcat	     20    0 11563M  9233M kqread  3   1:16   0.43% java{java}
43720 tomcat	     20    0 11563M  9233M kqread 12   1:15   0.43% java{java}
43720 tomcat	     20    0 11563M  9233M kqread 18   1:24   0.40% java{java}
after the patch:
46396 tomcat	      21    0  7228M  1004M uwait   3	0:46   7.80% java{C2
CompilerThread1}
46396 tomcat	      20    0  7228M  1004M uwait   2	0:49   2.73% java{C2
CompilerThread0}
46396 tomcat	      20    0  7228M  1004M uwait   0	0:42   1.83%
java{qtp927744186-64}
46396 tomcat	      20    0  7228M  1004M select  1	0:03   0.01% java{AMQP
Connection 0:0}
46349 tomcat	      20    0  7005M   816M kqread  1	0:02   0.00%
java{pool-7-thread-1}
46396 tomcat	      20    0  7228M  1004M kqread  0	0:09   0.10%
java{lettuce-nioEventLoo}

According to thr_set_name(2), the thread's name can be maximum 19 characters
(MAXCOMLEN + 1 bytes), we'll give a buffer of that size just to be sure.
The MacOS code prefixes everthing with "Java", but it's totally useless (as can
be seen above, just eats valuable space), so use only the name which is given
by the caller.


More information about the freebsd-java mailing list