From owner-freebsd-java@FreeBSD.ORG Tue Feb 12 10:28:04 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 D5839B61 for ; Tue, 12 Feb 2013 10:28:04 +0000 (UTC) (envelope-from david@code.davidpcaldwell.com) Received: from mail-ia0-x22a.google.com (ia-in-x022a.1e100.net [IPv6:2607:f8b0:4001:c02::22a]) by mx1.freebsd.org (Postfix) with ESMTP id A68C12F0 for ; Tue, 12 Feb 2013 10:28:04 +0000 (UTC) Received: by mail-ia0-f170.google.com with SMTP id k20so7519784iak.29 for ; Tue, 12 Feb 2013 02:28:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-originating-ip:in-reply-to:references :from:date:message-id:subject:to:content-type:x-gm-message-state; bh=6kOMXke6gTsvcGuIYV59mOT2Ip2UrFt3QtBAb5/ZehA=; b=SjRfmccmDv0iSwIzbDKRANWTKLBdJJ7WzArfzrtug9vwuNe4Wwk+mjXY0hVAFj1h3Q yuqO6aVZOErAOp3hh61OZdpV7Z/LEbniQ96IMSy86wEvrL7ALpT+k1AoAAs/z590k4ZH wIGXJUvMuxRVdVtyyDjfaxJn4k4KjjLJN8Q3piWHGPLizU3gHTE8Czhxl+jM0wIex+Md zdDHmdJaiXzSZG1K/kBx8jcuBTonqWm7OCy0sXbd9BcDFsdnXoS2ZAK2KZLTXRwG84oB 6BiPSzeSBgyAJYXMNwpet4AZhTETyudJAVrkcw8bVuTu3tC6FdeTdtFgVciLe74XXYuC MjZQ== X-Received: by 10.50.183.167 with SMTP id en7mr2184017igc.58.1360664883769; Tue, 12 Feb 2013 02:28:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.134.198 with HTTP; Tue, 12 Feb 2013 02:27:43 -0800 (PST) X-Originating-IP: [74.97.25.177] In-Reply-To: <1859971.L2l1UW0Dx7@smadev.internal.net> References: <1859971.L2l1UW0Dx7@smadev.internal.net> From: "David P. Caldwell" Date: Tue, 12 Feb 2013 05:27:43 -0500 Message-ID: Subject: Re: Problem with Java System.exit on OpenJDK 7 To: freebsd-java@freebsd.org, achill@matrix.gatewaynet.com X-Gm-Message-State: ALoCoQl5S+Sopb9capxVzf5ayoHTYqzZzACPEr5CMjKc07/YtIplwljsh3x+Zz6egbu7FIicHotI Content-Type: text/plain; charset=windows-1252 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 10:28:04 -0000 Well, I wasn't familiar with a lot of kernel debugging tools before, but I'm catching up. Ironically, this now appears related to the issue just discussed on this list a few days ago. I'm sure this will sound familiar to everyone. My ktrace from the relevant part of execution contains a huge number of these: 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 interpret it or what to do next. I can't even figure out where errno values for _umtx_op are documented, nor do I have any idea how to figure out what the VM is *actually* trying to do in this section. Any pointers or tips? On Tue, Feb 12, 2013 at 2:46 AM, Achilleas Mantzios < achill@smadev.internal.net> wrote: > some suggestions/thoughts : > - ktrace > - truss > - gdb against a _g version (debugging enabled) of OpenJDK 7 java (if > available) > - 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/Openjdk= 7 > 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 =CE=94=CE=B5=CF=85 11 =CE=A6=CE=B5=CE=B2 2013 17:15:23 David P. Caldwe= ll wrote: > > So I'm having a problem with the performance of a Java subprocess runni= ng > > under Java, running on 9.0-RELEASE i386. > > > > It's a big subprocess, difficult to decompose. It's a big parent proces= s, > > 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 > command. > > 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 a= dd > > 2.6 seconds of unnecessary execution time really slows things down. > > > > 1. The application has System.runFinalizersOnExit set to false; I check= ed > > in java.lang.Shutdown using reflection to be sure. > > > > 2. The application, during its shutdown, has only one shutdown hook to > run > > -- the application shutdown hooks hook. That application shutdown hooks > > 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 variable= s > > 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 > running > > 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 comma= nd > > line, one of the runs, using the same command line, actually completed > > System.exit in a time I'd expect -- about 0.03 seconds. The other took > > 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 the > > 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 an > > 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 present= s > no > > GUI. > > > > The application does reference the standard input stream but the > particular > > program I was running consumes no input. It references stdout and stder= r > as > > well, and is emitting output to those consoles. > > > > Does anyone have any idea or suggestions about where I should be lookin= g > at > > this point? Obviously it's hard to instrument the program further on > > FreeBSD -- I assume the NetBeans Profiler / jvisualvm stuff does not wo= rk > > 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.org" > - > 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"