Debugging segmentation faults in the JVM on linux-powerpc

Gustavo Romero gromero at linux.vnet.ibm.com
Fri Jun 9 14:30:29 UTC 2017


Hi John,

On 09-06-2017 10:15, John Paul Adrian Glaubitz wrote:
> Hi!
> 
> I'm currently trying to fix the build of openjdk-9 (b170) on linux-powerpc
> (PPC32) on Debian which fails with the following segmentation fault
> (full build log available in [1]):
> 
> Creating images/jmods/java.desktop.jmod
> /bin/rm -f /<<PKGBUILDDIR>>/build/images/jmods/java.desktop.jmod /<<PKGBUILDDIR>>/build/support/jmods/java.desktop.jmod
> /<<PKGBUILDDIR>>/build/jdk/bin/jmod -J-XX:+UseSerialGC -J-Xms32M -J-Xmx512M -J-XX:TieredStopAtLevel=1 create \
>             --module-version 9-Debian \
>             --target-platform 'linux-ppc' \
>             --module-path /<<PKGBUILDDIR>>/build/images/jmods \
>     --exclude '**{_the.*,_*.marker,*.diz,*.debuginfo,*.dSYM/**,*.dSYM,*.pdb,*.map}' \
>     --libs /<<PKGBUILDDIR>>/build/support/modules_libs/java.desktop --cmds /<<PKGBUILDDIR>>/build/support/modules_cmds/java.desktop --config /<<PKGBUILDDIR>>/build/support/modules_conf/java.desktop --class-path /<<PKGBUILDDIR>>/build/jdk/modules/java.desktop --header-fil
> es /<<PKGBUILDDIR>>/build/support/modules_include/java.desktop --legal-notices "/<<PKGBUILDDIR>>/build/support/modules_legal/java.base:/<<PKGBUILDDIR>>/src/jdk/src/java.desktop/unix/legal:/<<PKGBUILDDIR>>/src/jdk/src/java.desktop/share/legal" /<<PKGBUILDDIR>>/build/suppo
> rt/jmods/java.desktop.jmod
> (...)
> make[4]: *** [/<<PKGBUILDDIR>>/build/images/jmods/java.desktop.jmod] Segmentation fault
> CreateJmods.gmk:133: recipe for target '/<<PKGBUILDDIR>>/build/images/jmods/java.desktop.jmod' failed
> make[4]: Leaving directory '/<<PKGBUILDDIR>>/src/make'
> make/Main.gmk:305: recipe for target 'java.desktop-jmod' failed
> make[3]: *** [java.desktop-jmod] Error 2
> make[3]: Leaving directory '/<<PKGBUILDDIR>>/src'
> 
> To reproduce the segfault, I tried running the command above but whichever
> way I try to run the jmod command, it just bails out with an error message
> about insufficient memory:
> 
> (sid-powerpc-sbuild)root at kapitsa:/build/openjdk-9-2gWg6b/openjdk-9-9~b170/build/jdk/bin# ./jmod
> Error occurred during initialization of boot layer
> java.lang.OutOfMemoryError: Direct buffer memory
> (sid-powerpc-sbuild)root at kapitsa:/build/openjdk-9-2gWg6b/openjdk-9-9~b170/build/jdk/bin#
> 
> This applies to all the various Java commands I tried (javac, java etc) as
> well. Does anyone have an idea what I am overlooking here?
> 
> Also, does anyone have any pointers to debugging such issues in JVM? It's probably
> not just a matter of loading the offending command into gdb with the proper
> version of libjvm.so preloaded, is it?

You can attach gdb when the error occurs passing to the JVM:

-XX:OnError="gdb %p"
-XX:OnOutOfMemoryError="gdb %p"

Another thing is that the JVM will use SIGSEGV for some state transitions, hence
in gdb I usually let SIGSEGV be passed to the JVM:

(gdb) handle SIGSEGV pass noprint nostop

On PPC64 (not sure what's the current state on PPC32) we can also have SIGTRAP
for state transitions and I had some trouble in the past debugging with
-XX:+UseSIGTRAP enabled (basically gdb halts on some specific thread types that
generates such a type of signal), so I also usually ask to the JVM to not use
SIGTRAP and use SIGILL instead, enabling the passthrough of SIGILL:

(gdb) handle SIGILL pass noprint nostop

and calling the JVM with "-XX:-UseSIGTRAP".

Starting the JVM from gdb it's also fine given that you handle the signals,
otherwise all can go well until init_globals() but beyond that, after some
threads are created, the debugging can halt for no apparently reason.

HTH

Cheers,
Gustavo

> Thanks,
> Adrian
> 
>> [1] https://people.debian.org/~glaubitz/openjdk-9_9~b170-2_powerpc.build.gz
> 



More information about the hotspot-dev mailing list