From owner-freebsd-java@FreeBSD.ORG Tue Feb 12 14:54:59 2013 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 18138CAC for ; Tue, 12 Feb 2013 14:54:59 +0000 (UTC) (envelope-from achill@matrix.gatewaynet.com) Received: from smadev.internal.net (adsltrust.ath.forthnet.gr [194.219.204.174]) by mx1.freebsd.org (Postfix) with ESMTP id E1FB696D for ; Tue, 12 Feb 2013 14:54:57 +0000 (UTC) X-Bogosity: No, tests=bogofilter Received: from smadev.internal.net (localhost [127.0.0.1]) by smadev.internal.net (8.14.5/8.14.5) with ESMTP id r1CEsqAk049258; Tue, 12 Feb 2013 16:54:52 +0200 (EET) (envelope-from achill@matrix.gatewaynet.com) Received: (from achill@localhost) by smadev.internal.net (8.14.5/8.14.5/Submit) id r1CEsqMf049257; Tue, 12 Feb 2013 16:54:52 +0200 (EET) (envelope-from achill@matrix.gatewaynet.com) X-Authentication-Warning: smadev.internal.net: achill set sender to achill@matrix.gatewaynet.com using -f From: Achilleas Mantzios To: "David P. Caldwell" , freebsd-java@freebsd.org Subject: Re: Re: Problem with Java System.exit on OpenJDK 7 Date: Tue, 12 Feb 2013 16:54:52 +0200 Message-ID: <1511992.Een906lH7c@smadev.internal.net> Organization: Dynacom Tankers Mgmt X-Face: "g.Z.Lx$T1ZMcQ%hC!e^E&tD,cT:"bTs45WM(,vUj@8QBz6}T'sn+EnZTzy`UVQ:&A=`_; f)V+K4z}rG5:(uu[b:WY'*`6F"ou-Or(q; u{#Gxx|MkO4E.vh@E}[#7Ytt"shtU>A&@CO` a|Wx]m_wRD,?4!'Ir1$4iis{/.WU<`#dhKI]g2w^!B[CvRJr+W|; -VS~QcL!s1"'??rct} ^=5Fa!W!{a}Jd:W%6,E[N\r-<)T'_N[~3fy9pF"b>-Yj^p}/2tPudP>I"$%w]"W4CIja6J Tajm}"8t`-hJlf2kRQ_V,eT_kN6KLG+~2mZ+cPX,p,xQN9QVR References: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Feb 2013 14:54:59 -0000 If you haven't cleaned the sources yet, why don't you look at the speci= fic implementations=20 of System.exit() in opnjdk 7 vs openjdk 6, in /usr/ports/java ? On =CE=A4=CF=81=CE=B9 12 =CE=A6=CE=B5=CE=B2 2013 09:49:38 you wrote: One additional insight: the problem exists in openjdk7, but not openjdk= 6. On Tue, Feb 12, 2013 at 9:23 AM, David P. Caldwell wrote: It appears whatever is happening is happening within the halt0 native m= ethod inside java.lang.Shutdown. If I replace Shutdown with my own vers= ion and prepend it to the bootclasspath, the statement prior to the inv= ocation of halt0 executes before the delay begins. Still no idea what l= ock the program is trying to acquire. I'm going to try to learn and use= gdb and see if it reveals anything, so first I'm building a debug vers= ion of the port.=20 On Tue, Feb 12, 2013 at 5:27 AM, David P. Caldwell wrote: Well, I wasn't familiar with a lot of kernel debugging tools before, bu= t I'm catching up. Ironically, this now appears related to the issue just discussed on thi= s list a few days ago. I'm sure this will sound familiar to everyone. M= y ktrace from the relevant part of execution contains a huge number of = these:=20 26795 java 1.808597 CALL _umtx_op(0x2831e068,0xf,0,0,0xbf7a9870) 26795 java 1.838640 RET _umtx_op -1 errno 60 Operation timed out= A bit of web searching reveals that this probably is related to libthr,= but I am pretty green in this area (I mostly stay way above the system= libraries in my day-to-day work), so I'm not quite sure how to interpr= et it or what to do next. I can't even figure out where errno values fo= r _umtx_op are documented, nor do I have any idea how to figure out wha= t the VM is *actually* trying to do in this section.=20 Any pointers or tips? On Tue, Feb 12, 2013 at 2:46 AM, Achilleas Mantzios wrote: some suggestions/thoughts : - ktrace - truss - gdb against a _g version (debugging enabled) of OpenJDK 7 java (if av= ailable) - jdb I doubt KDE or anything would have any relation to your problem. It might more likely be related to libthr/libc What version of Java do you have on Windows? You have to realize jumping from Windows/(Oracle?)Java to FreeBSD/Openj= dk7 makes a huge difference. Hmmmm this looks also like a TCP/IP timeout kind of thing... just a raw= speculation. Can you try with disabling IPV6? On =C3=8E=E2=80=9D=C3=8E=C2=B5=C3=8F=E2=80=A6 11 =C3=8E=C2=A6=C3=8E=C2=B5= =C3=8E=C2=B2 2013 17:15:23 David P. Caldwell wrote: > So I'm having a problem with the performance of a Java subprocess run= ning > under Java, running on 9.0-RELEASE i386. > > It's a big subprocess, difficult to decompose. It's a big parent proc= ess, > difficult to decompose. I'm working on it. I've nearly ruled out the = parent > process as the culprit (see below), but I include it for completeness= , just > in case there's something I'm missing. > > Everything runs as expected on Windows, which brings me here to this = list. > > Basically, the parent process launches the subprocess using a Java co= mmand. > It runs. It runs fine. The *subprocess* calls System.exit(0). That's = where > the weirdness begins. > > System.exit(), for this program, takes about 2.6 seconds to run. And = I > can't figure out why. It takes 0.025 seconds on Windows. > > The program is a command shell, essentially, so having every subshell= add > 2.6 seconds of unnecessary execution time really slows things down. > > 1. The application has System.runFinalizersOnExit set to false; I che= cked > in java.lang.Shutdown using reflection to be sure. > > 2. The application, during its shutdown, has only one shutdown hook t= o run > -- the application shutdown hooks hook. That application shutdown hoo= ks > hook has one hook, registered by me, which prints the timestamp (for = trying > to debug this), only. Something takes 2.6 seconds to end the VM after= this. > > 3. There are no temporary files to delete; I checked in > java.io.DeleteFilesOnExit using reflection to make sure. The system > registered shutdown hook in the slot for DeleteFilesOnExit is null. > > The problem appears to have nothing to do with the parent process. I > synthesized a giant command line command using the environment variab= les > and system properties under which the subprocess is running, and ran = it > from the bash prompt, and still got the 2.6 second delay, based on ru= nning > the program inside a bash wrapper that first ran the subprocess giant= > command, then printed the system time. I'm 99.9% ready to rule it out= based > on that. > > During one experiment, when running the program twice on the same com= mand > line, one of the runs, using the same command line, actually complete= d > System.exit in a time I'd expect -- about 0.03 seconds. The other too= k > about 2.6 seconds. All subsequent runs have take about two-and-a-half= > seconds after the shutdown hooks; I haven't been able to reproduce th= e > success and I am quite sure I didn't change anything. > > I'm running this in a graphical terminal on KDE; haven't tried from a= n > ordinary console (obviously I am gradually broadening the things I'm = doing, > so I'll probably get to that). The program is not graphical and prese= nts no > GUI. > > The application does reference the standard input stream but the part= icular > program I was running consumes no input. It references stdout and std= err as > well, and is emitting output to those consoles. > > Does anyone have any idea or suggestions about where I should be look= ing at > this point? Obviously it's hard to instrument the program further on > FreeBSD -- I assume the NetBeans Profiler / jvisualvm stuff does not = work > on FreeBSD; that's the last I heard. > _______________________________________________ > freebsd-java@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-java > To unsubscribe, send any mail to "freebsd-java-unsubscribe@freebsd.or= g" - Achilleas Mantzios IT DEV IT DEPT _______________________________________________ freebsd-java@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-java To unsubscribe, send any mail to "freebsd-java-unsubscribe@freebsd.org"= - Achilleas Mantzios IT DEV IT DEPT Dynacom Tankers Mgmt From owner-freebsd-java@FreeBSD.ORG Tue Feb 12 15:44:24 2013 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 75D61E17 for ; Tue, 12 Feb 2013 15:44:24 +0000 (UTC) (envelope-from ronald-freebsd8@klop.yi.org) Received: from cpsmtpb-ews10.kpnxchange.com (cpsmtpb-ews10.kpnxchange.com [213.75.39.15]) by mx1.freebsd.org (Postfix) with ESMTP id ECB0ACCC for ; Tue, 12 Feb 2013 15:44:23 +0000 (UTC) Received: from cpsps-ews29.kpnxchange.com ([10.94.84.195]) by cpsmtpb-ews10.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Tue, 12 Feb 2013 16:43:05 +0100 Received: from CPSMTPM-TLF104.kpnxchange.com ([195.121.3.7]) by cpsps-ews29.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Tue, 12 Feb 2013 16:43:05 +0100 Received: from sjakie.klop.ws ([212.182.167.131]) by CPSMTPM-TLF104.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Tue, 12 Feb 2013 16:44:22 +0100 Received: from 212-182-167-131.ip.telfort.nl (localhost [127.0.0.1]) by sjakie.klop.ws (Postfix) with ESMTP id 8B4965CA7; Tue, 12 Feb 2013 16:44:22 +0100 (CET) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes To: freebsd-java@freebsd.org, "David P. Caldwell" Subject: Re: Problem with Java System.exit on OpenJDK 7 References: Date: Tue, 12 Feb 2013 16:44:22 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Ronald Klop" Message-ID: In-Reply-To: User-Agent: Opera Mail/12.14 (FreeBSD) X-OriginalArrivalTime: 12 Feb 2013 15:44:22.0768 (UTC) FILETIME=[D429BF00:01CE0937] X-RcptDomain: freebsd.org X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Feb 2013 15:44:24 -0000 On Mon, 11 Feb 2013 23:15:23 +0100, David P. Caldwell wrote: > So I'm having a problem with the performance of a Java subprocess running > under Java, running on 9.0-RELEASE i386. > [snip] > > Does anyone have any idea or suggestions about where I should be looking > at > this point? Obviously it's hard to instrument the program further on > FreeBSD -- I assume the NetBeans Profiler / jvisualvm stuff does not work > on FreeBSD; that's the last I heard. Since a short time there is this. /usr/ports/java/visualvm/