Subject: gcj thread/gc status on current
To: None <current-users@netbsd.org>
From: Bart Locanthi <bart@sabl.com>
List: current-users
Date: 09/16/2003 17:05:57
hi all,

i'm running gcj-3.3.1 on current as of 2003.08.11 and am having trouble 
with, i think, gc as it interacts with threads.

a two-year-old message on the gcc mailing list ( 
http://gcc.gnu.org/ml/gcc/2001-08/msg00203.html ) illustrates a simple 
thread-cum-gc example that dumps core on my current system if slightly 
modified:

class xyz extends Thread {
    public void run() {
        for( int i=0; i < 10000; i++ )
            System.out.println("Hello World, " + i);
    }
    public static void main (String[] args) {
        for (int i = 0; i < 20; i++)
            new xyz().start();
    }
}

it gets a certain distance and dumps core. slight variations of the prog 
change the loop count at time of death, but the effect and stack trace 
are the same:

Hello World, 2478
Hello World, 2479
Hello World, 2480
Hello World, 2481
Hello World, 2482Segmentation fault (core dumped)

#0  0x48561723 in GC_clear_stack_inner () from /usr/pkg/gcc3/lib/libgcj.so.4
(gdb) bt
#0  0x48561723 in GC_clear_stack_inner () from /usr/pkg/gcc3/lib/libgcj.so.4
#1  0x48561774 in GC_clear_stack_inner () from /usr/pkg/gcc3/lib/libgcj.so.4
#2  0x48561774 in GC_clear_stack_inner () from /usr/pkg/gcc3/lib/libgcj.so.4
...
#283 0x48561774 in GC_clear_stack_inner () from 
/usr/pkg/gcc3/lib/libgcj.so.4
#284 0x48561871 in GC_clear_stack () from /usr/pkg/gcc3/lib/libgcj.so.4
#285 0x4855ea5e in GC_malloc_atomic () from /usr/pkg/gcc3/lib/libgcj.so.4
#286 0x48377d0b in _Jv_NewPrimArray () from /usr/pkg/gcc3/lib/libgcj.so.4
#287 0x4841d425 in 
gnu.gcj.runtime.StringBuffer.StringBuffer(java.lang.String)
    (this=0x8110170, str=0x80779f0) at gnu/gcj/runtime/StringBuffer.java:179
#288 0x080492be in xyz.run() ()
#289 0x483b168e in _Jv_ThreadRun(java::lang::Thread*) ()
   from /usr/pkg/gcc3/lib/libgcj.so.4
#290 0x4855915c in really_start(void*) () from /usr/pkg/gcc3/lib/libgcj.so.4
#291 0x489516ce in pthread_create () from /usr/lib/libpthread.so.0

am i missing something from my configuration (current and/or gcj) or has 
gcj threading not quite met up with current native threading?