Hello World coredumps

Boehm, Hans hboehm@exch.hpl.hp.com
Wed Nov 10 16:09:00 GMT 1999


If you give me one guess, I'd say that you rebuilt the kernel to allow for
more or less virtual address space than in the standard build.  This causes
the primordial stack to have a different start address, which causes the
garbage collector to look for it in the wrong place, which would lead to the
symptoms you describe.

This is fixed in the 5.0alpha4 version of the collector, thanks to David
Mosberger who pointer out that it is possible to reliably read the correct
stack base value from /proc.  (Unfortunately, I hadn't understood the
problem until fairly recently.)

If this is correct, then the problem should go away on a standard kernel.
If it is incorrect, I'd like to know the fault address, and the output
generated from a call to GC_dump() from the debugger.

If the diagnosis is correct, you have two ways to fix it:

1) Rebuild with a fixed GC.  (A new version will do.  Or there's a one line
stopgap I can suggest.)
2) Run on a standard kernel.

Hans

-----Original Message-----
From: acruise@globalmedia.com [ mailto:acruise@globalmedia.com ]
Sent: Wednesday, November 10, 1999 1:35 PM
To: java-discuss@sourceware.cygnus.com
Subject: Hello World coredumps


Okay... I've seen this problem in the archives before, but have yet to
find a solution:

My system:

Red Hat Linux 6.0 on i686
Linux 2.2.13 (custom build)
libstdc++ 2.9.0-12

I know some of you will scream about this, but I'm a little pressed for
time, so I used the following RPMs from http://rpmfind.net:

binutils-2.9.1.0.25-5mdk.i586.rpm
gcc-java-2.95-4.i686.rpm
gcc-2.95-4.i686.rpm                
gcc-libgcj-2.95-4.i686.rpm
gcc-c++-2.95-4.i686.rpm
cpp-2.95.1-3.i386.rpm (there was no RPM of cpp-2.95, might this cause
problems?)

========
My boilerplate program:
========
HelloWorld.java:
public class HelloWorld  {
    public static void main( String args[] ) {
	System.out.println( "Hello world!" );
    }
}

========
I run:
========

$ unset CLASSPATH 
$ gcj -g --main=HelloWorld HelloWorld.java -o hello
$ ls -l hello
-rwxrwxr-x   1 alex     alex        18554 Nov 10 13:28 hello
$ ./hello
Segmentation fault (core dumped)

========
Following earlier instructions from the list archives, I then run:
========

$gdb hello
[blah blah blah...]
(gdb) run
Starting program: /home/alex/dev/java/alex/hello 

Program received signal SIGSEGV, Segmentation fault.
0x2ac5cf02 in GC_push_all_stack ()
(gdb) bt
#0  0x2ac5cf02 in GC_push_all_stack ()
#1  0x2ac5a20a in GC_push_all_stacks ()
#2  0x2ac5f13f in GC_default_push_other_roots ()
#3  0x2ac5da2e in GC_push_roots ()
#4  0x2ac5beb6 in GC_mark_some ()
#5  0x2ac56b3d in GC_stopped_mark ()
#6  0x2ac56c03 in GC_try_to_collect_inner ()
#7  0x2ac5e08a in GC_init_inner ()
#8  0x2ac5ae50 in GC_generic_malloc_inner ()
#9  0x2ac5b663 in GC_generic_malloc ()
#10 0x2abb7c7c in _Jv_AllocBytes ()
#11 0x2ab3a4d2 in _Jv_makeUtf8Const ()
#12 0x2aba1f86 in __static_initialization_and_destruction_0 ()
#13 0x2aba2785 in global constructors keyed to
java::lang::Class::forName ()
#14 0x2abbb0ca in __do_global_ctors_aux ()
#15 0x2ab35d1e in _init ()
========

Look familiar?  I don't even know where to begin.

TIA,

Alex.


More information about the Java mailing list