Java binary, can't redirect stderr on VM crash

Mark Wielaard mark at
Thu Nov 27 22:04:16 UTC 2008

Hi Patrick,

On Thu, 2008-11-27 at 22:24 +0100, Patrick Wright wrote:
> 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/[0xb7f753f4]
> /lib/tls/i686/cmov/[0xb7f77456]
> /usr/lib/jvm/java-6-openjdk/jre/lib/i386/[0xb4d37073]
> /usr/lib/jvm/java-6-openjdk/jre/lib/i386/[0xb4d3cec0]
> /usr/lib/jvm/java-6-openjdk/jre/lib/i386/[0xb4d3f42d]
> /usr/lib/jvm/java-6-openjdk/jre/lib/i386/[0xb4d3f530]

If you have the debug info packages installed you can probably run this
under gdb and get a good backtrace leading directly to the source code
that calls the bad free().

You might also get more glibc malloc checking by export MALLOC_CHECK_=3
(see man malloc). That might catch an issue somewhat earlier.

> 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_.

And probably also in a hs_err_pid[0-9].log file in your working

I am not sure why your redirecting doesn't work. The first variant
should indeed do what you want.

If you could post the file then I could try to
replicate locally if you want.



More information about the discuss mailing list