From owner-freebsd-java@FreeBSD.ORG Tue Aug 9 07:37:41 2005 Return-Path: X-Original-To: freebsd-java@freebsd.org Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C387516A41F for ; Tue, 9 Aug 2005 07:37:41 +0000 (GMT) (envelope-from freebsd@spatula.net) Received: from turing.morons.org (turing.morons.org [209.237.229.34]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7B51543D45 for ; Tue, 9 Aug 2005 07:37:41 +0000 (GMT) (envelope-from freebsd@spatula.net) Received: by turing.morons.org (Postfix, from userid 1001) id 4D1A3A935; Tue, 9 Aug 2005 00:38:35 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by turing.morons.org (Postfix) with ESMTP id 3B9F1A928 for ; Tue, 9 Aug 2005 00:38:35 -0700 (PDT) Date: Tue, 9 Aug 2005 00:38:35 -0700 (PDT) From: Nick Johnson X-X-Sender: spatula@turing.morons.org To: freebsd-java@freebsd.org Message-ID: <20050809000303.D7871@turing.morons.org> X-what-happen: someone set up us the bomb X-Message-Flags: Spatula Precedence: special-delivery MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: java-1.4.2-p7 100% CPU usage (threading problem?) X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2005 07:37:41 -0000 Environment is java-1.4.2_08-p7, built on FreeBSD 5.4-STABLE as of August 5. This is pretty easy to replicate, so I hope that helps. I don't think the Resin/Apache integration is necessary to duplicate this problem, but I'm including that information just for completeness. You can probably skip everything to do with Apache and still see the problem. Build Apache2 out of ports. Download Resin 3.0.14 here: http://www.caucho.com/download/resin-3.0.14.tar.gz tar xzvf resin-3.0.14.tar.gz cd resin-3.0.14 Configure with ./configure --with-java-home=/usr/local/jdk1.4.2 --with-apxs=/usr/local/bin/apxs Make using "make" and then make install. Set JAVA_HOME and RESIN_HOME in bin/http.sh. Also add args=-J-Djaa.net.preferIPv4Stack=true Stop/Start apache2, then start Resin using bin/httpd.sh with no parameters. You should be able to load http://localhost/caucho-status and see that Host localhost:6802 is up. Now hit ^C or ^Z in the window where you started httpd.sh. Observe that it doesn't exit, and that if your run top, you'll see java using all the CPU it can, approaching 100%. It will not exit. It will not respond to kill -3 or kill -6. A truss -p shows the process in an infinite loop making the same kse_release call repeatedly. A ktrace also shows a RET kse_release 0 following each kse_release call. I did manage to get a stack trace with gcore; here's the stack trace: #0 0x48097353 in pthread_testcancel () from /usr/lib/libpthread.so.1 #1 0x4808fc05 in pthread_mutexattr_init () from /usr/lib/libpthread.so.1 #2 0x48093be0 in pthread_setconcurrency () from /usr/lib/libpthread.so.1 #3 0x4808a405 in _nanosleep () from /usr/lib/libpthread.so.1 #4 0x4808a4fe in nanosleep () from /usr/lib/libpthread.so.1 #5 0x4808162b in select () from /usr/lib/libpthread.so.1 #6 0x48460e09 in os_sleep () from /usr/local/jdk1.4.2/jre/lib/i386/client/libjvm.so #7 0x48460fcd in os::sleep () from /usr/local/jdk1.4.2/jre/lib/i386/client/libjvm.so #8 0x484a9933 in WatcherThread::run () from /usr/local/jdk1.4.2/jre/lib/i386/client/libjvm.so #9 0x4845f1d7 in _start () from /usr/local/jdk1.4.2/jre/lib/i386/client/libjvm.so #10 0x48083b09 in pthread_create () from /usr/lib/libpthread.so.1 #11 0x4813f85b in _ctx_start () from /lib/libc.so.5 Looks like maybe this thread isn't shutting down cleanly? The stuck thread seems to always be this one, though it's hard to be 100% certain. Nick -- "The aptly-named morons.org is an obscenity-laced screed..." -- Robert P. Lockwood, Catholic League director of research Nick Johnson, version 2.1 http://web.morons.org/