java-1.4.2-p7 100% CPU usage (threading problem?)

Nick Johnson freebsd at spatula.net
Tue Aug 9 07:37:41 GMT 2005


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/


More information about the freebsd-java mailing list