Java binary, can't redirect stderr on VM crash

Christopher Hegarty - Sun Microsystems Christopher.Hegarty at Sun.COM
Thu Nov 27 22:11:06 UTC 2008


Hi Patrick,

I'm certainly not an expert in this area, but coincidentally I just 
looked into a similar issue related to redirecting vm output. The java 
launcher does exec to replace the current process image with a new 
process image in order to set various environment variables, etc. 
Therefore, there can be issues relating to env variables inherited and 
maybe in your case redirection.

With Sun's JDK 6 and OpenJDK you should be able to redirect the vm 
output to a log file with the following options.
   -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput 
-XX:LogFile=/tmp/hotspot.log

-Chris.


Patrick Wright wrote:
> Hi all
> 
> I'm trying to track down a VM crash related to some part of the 2D
> stack. I've already written 2D-dev and they asked me to narrow it
> down. I have a question about how bin/java handles error output on a
> VM crash.
> 
> Problem: I'm testing from the CLI, bash, on Ubuntu 8.10. I need to run
> my test program once for every font on the full font list for the JRE.
> However, when the program crashes (on working with the font), I get
> several dozen lines of VM crash output, and I'm not able to redirect
> this to a file. This is painful and I have many fonts to test to try
> and track the problem down.
> 
> Example crash output starts like:
> *** glibc detected *** /usr/lib/jvm/java-6-openjdk/bin/java: free():
> invalid next size (fast): 0xb4cc7288 ***
> ======= Backtrace: =========
> /lib/tls/i686/cmov/libc.so.6[0xb7f753f4]
> /lib/tls/i686/cmov/libc.so.6(cfree+0x96)[0xb7f77456]
> /usr/lib/jvm/java-6-openjdk/jre/lib/i386/libfontmanager.so[0xb4d37073]
> /usr/lib/jvm/java-6-openjdk/jre/lib/i386/libfontmanager.so[0xb4d3cec0]
> /usr/lib/jvm/java-6-openjdk/jre/lib/i386/libfontmanager.so[0xb4d3f42d]
> /usr/lib/jvm/java-6-openjdk/jre/lib/i386/libfontmanager.so[0xb4d3f530]
> 
> 
> I've tried redirect like
> java -cp out/production/Samples RenderFontTest "AR PL UMing CN" &>/tmp/err.txt
> java -cp out/production/Samples RenderFontTest "AR PL UMing CN" 2>/tmp/err.txt
> java -cp out/production/Samples RenderFontTest "AR PL UMing CN" 2>&1
>> /tmp/err.txt
> 
> In all cases, the crash report goes to the console. This happens with
> both Sun JDK 6 and OpenJDK 6. And the output is _long_.
> 
> Versions involved:
> 
> tuxdistro at ubuntu-desktop:~
> $ /usr/lib/jvm/java-6-openjdk/bin/java -version
> java version "1.6.0_0"
> IcedTea6 1.3.1 (6b12-0ubuntu6) Runtime Environment (build 1.6.0_0-b12)
> OpenJDK Client VM (build 1.6.0_0-b12, mixed mode, sharing)
> tuxdistro at ubuntu-desktop:~
> 
> $ java -version
> java version "1.6.0_10"
> Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
> Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)
> 
> tuxdistro at ubuntu-desktop:~
> $ bash -version
> GNU bash, version 3.2.39(1)-release (i486-pc-linux-gnu)
> Copyright (C) 2007 Free Software Foundation, Inc.
> 
> Is the bin/java binary forking a process off?
> 
> 
> TIA, please redirect me if there's a better place to ask.
> Patrick
> 
> PS: my bash-fu is very weak, sadly



More information about the discuss mailing list