Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jun 2002 09:48:46 -0700 (PDT)
From:      "Robert F. Ross" <rross@recourse.com>
To:        freebsd-java@freebsd.org
Subject:   green vs. native threads
Message-ID:  <Pine.GSO.4.21.0206050940450.1002-100000@recourse.com>

next in thread | raw e-mail | index | archive | help
On the suggestion from people here about using native threads instead of
green threads I tried running the VM with -native. I never managed to get
select() or poll() behaving right through JNI with green threads. With
native threads, they appear to behave exactly as they should. The problem
is, with native threads my java process eats 100% CPU. When I try to
attach with gdb to see where this is happening, it appears to always
attach with a backtrace of:

#0  0x280c1c69 in _thread_sigframe_restore () from /usr/lib/libc_r.so.4
#1  0x280c1a68 in _thread_sig_wrapper () from /usr/lib/libc_r.so.4
#2  0x280c1252 in _thread_sig_handle_pending () from /usr/lib/libc_r.so.4
#3  0x280c0772 in _thread_sig_handler () from /usr/lib/libc_r.so.4
#4  0xbfbfffac in ?? ()
#5  0x2819eeb9 in args_done ()
   from /usr/local/jre-image-i386/lib/i386/classic/libjvm.so
#6  0x2816a3c1 in invokeJNINativeMethod ()
   from /usr/local/jre-image-i386/lib/i386/classic/libjvm.so
#7  0x81eab08 in ?? ()
#8  0x80be200 in ?? ()
#9  0x8198a08 in ?? ()
Error accessing memory address 0x2e: Bad address.

the address is always the same. If I try to stepi, nexti, next, etc. to
see what it's doing gdb just hangs (it also says ptrace is claiming the
process doesn't exist if I try to quit). The above backtrace is from
thread 1, there's 6 threads total. 4 of them are in _thread_kern_sched
either from a pthread cond wait or a timedwait. One is the backtrace I
just pasted above, and the other is:

#0  0x2c2ba7b3 in push_stack ()
   from /usr/local/jre-image-i386/lib/i386/libverify.so
Error accessing memory address 0xe7528fd4: Bad address.

I'm using the same exact jar file with both threading models. Under green
threads, select() and poll() seem to sometimes behave properly and
sometimes just wait the timeout before returning regardless (it appears
write related but I'm not certain). Under native threads, select() and
poll() both work properly but the CPU utilization jumps to 100%.

Has anyone seen either of these issues or have any idea what may be
causing them?

Thanks.

Robert Ross
Senior Software Engineer
Recourse Technologies, Inc.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.21.0206050940450.1002-100000>