[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


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223589

            Bug ID: 223589
           Summary: [PATCH] java/openjdk8: support setting thread name in
                    OpenJDK8
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Keywords: patch
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: java at FreeBSD.org
          Reporter: bra at fsn.hu
          Assignee: java at FreeBSD.org
             Flags: maintainer-feedback?(java at FreeBSD.org)
          Keywords: patch

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-java mailing list