This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Thread/GC failure of gcj-3.3.1 on netbsd-current


This isn't quite a cross-post, and I suspect the problem described here has more to do with NetBSD than GCJ, but I'm hoping the symptom rings some bells here that would lead to understanding in NetBSD-land.

netbsd-current has kernel threads, and gcc-3.3.1 installs fine via pkgsrc on it. Simple threaded things work (which they didn't up through NetBSD-1.6.1) .. until they require a GC. Then all hell breaks loose, in a way very similar to that observed in this two-year-old post.

http://gcc.gnu.org/ml/java/2001-12/msg00141.html

I'm wondering if there's something fundamental with kernel threads on netbsd-current, or if there's some odd environmental thing (though see below for PATH and LD_LIBRARY_PATH settings), or perhaps a configuration thing done wrong by the pkgsrc.

After updating to *really* current (20030917 == 1.6ZC) and deinstalling/distclean/installing gcc-3.3.1, I am still unable to get very far with Threads under GCJ/NetBSD. This and vastly more complex examples work fine under Linux.

Program, execution, and stack trace below:

$ cat al.java
public class al extends Thread {
int n;
int m;
public al(int i, int j) {
n = i;
m = j;
}
public void run() {
for (int i = 0; i < n; i++)
System.err.println("hello world: "+m+": "+i);
}
static public void main(String arg[]) {
int N = 10000;
int M = 10;
if (arg.length > 0)
N = Integer.parseInt(arg[0]);
if (arg.length > 1)
M = Integer.parseInt(arg[1]);
for (int j = 0; j < M; j++)
new al(N, j).start();
}
}
$ echo $PATH
/usr/pkg/gcc3/bin:/usr/pkg/bin:/usr/local/bin:/usr/bin:/bin
$ echo $LD_LIBRARY_PATH
/usr/pkg/gcc3/lib:/usr/pkg/lib
$ gcj -o al -g --main=al al.java
$ ./al 100 10 # 10 threads counting to 100
hello world: 0: 0
hello world: 0: 1
hello world: 0: 2
...
hello world: 6: 47
hello world: 6: 48
Segmentation fault (core dumped)
$ gdb al al.core
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386--netbsdelf"...
Core was generated by `al'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/libexec/ld.elf_so...done.
Loaded symbols for /usr/libexec/ld.elf_so
Reading symbols from /usr/pkg/gcc3/lib/libgcc_s.so.1...done.
Loaded symbols for /usr/pkg/gcc3/lib/libgcc_s.so.1
Reading symbols from /usr/pkg/gcc3/lib/libgcj.so.4...done.
Loaded symbols for /usr/pkg/gcc3/lib/libgcj.so.4
Reading symbols from /usr/lib/libm387.so.0...done.
Loaded symbols for /usr/lib/libm387.so.0
Reading symbols from /usr/lib/libm.so.0...done.
Loaded symbols for /usr/lib/libm.so.0
Reading symbols from /usr/lib/libpthread.so.0...done.
Loaded symbols for /usr/lib/libpthread.so.0
Reading symbols from /usr/lib/libz.so.0...done.
Loaded symbols for /usr/lib/libz.so.0
Reading symbols from /usr/lib/libc.so.12...done.
Loaded symbols for /usr/lib/libc.so.12
Reading symbols from /usr/lib/i18n/libiconv_std.so.4.3...done.
Loaded symbols for /usr/lib/i18n/libiconv_std.so.4.3
Reading symbols from /usr/lib/i18n/libUTF8.so.4.3...done.
Loaded symbols for /usr/lib/i18n/libUTF8.so.4.3
Reading symbols from /usr/lib/i18n/libUTF1632.so.4.3...done.
Loaded symbols for /usr/lib/i18n/libUTF1632.so.4.3
Reading symbols from /usr/lib/i18n/libmapper_none.so.4.3...done.
Loaded symbols for /usr/lib/i18n/libmapper_none.so.4.3
#0 0x48563737 in GC_clear_stack_inner () from /usr/pkg/gcc3/lib/libgcj.so.4
(gdb) bt
#0 0x48563737 in GC_clear_stack_inner () from /usr/pkg/gcc3/lib/libgcj.so.4
#1 0x48563788 in GC_clear_stack_inner () from /usr/pkg/gcc3/lib/libgcj.so.4
#2 0x48563788 in GC_clear_stack_inner () from /usr/pkg/gcc3/lib/libgcj.so.4
...
#282 0x48563788 in GC_clear_stack_inner () from /usr/pkg/gcc3/lib/libgcj.so.4
#283 0x48563788 in GC_clear_stack_inner () from /usr/pkg/gcc3/lib/libgcj.so.4
#284 0x48563885 in GC_clear_stack () from /usr/pkg/gcc3/lib/libgcj.so.4
#285 0x48560a72 in GC_malloc_atomic () from /usr/pkg/gcc3/lib/libgcj.so.4
#286 0x48379d0b in _Jv_NewPrimArray () from /usr/pkg/gcc3/lib/libgcj.so.4
#287 0x4841f425 in gnu.gcj.runtime.StringBuffer.StringBuffer(java.lang.String)
(this=0x80e1630, str=0x80779f0) at gnu/gcj/runtime/StringBuffer.java:179
#288 0x0804923e in al.run() (this=0x80adea0) at al.java:10
#289 0x483b368e in _Jv_ThreadRun(java::lang::Thread*) ()
from /usr/pkg/gcc3/lib/libgcj.so.4
#290 0x4855b170 in really_start(void*) () from /usr/pkg/gcc3/lib/libgcj.so.4
#291 0x4895399e in pthread_create () from /usr/lib/libpthread.so.0



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]