users@glassfish.java.net

Re: Glassfish 3 Error With StdErrDrainer - Outofmemoryerror out of heap space

From: Tom Mueller <tom.mueller_at_oracle.com>
Date: Wed, 27 Apr 2011 09:24:52 -0500

A thread called "domain1-stderrdrainer" should only be created in the
asadmin start-domain command that is used to start the server, and not
in the GlassFish server process itself. This thread is created by the
GFLauncher class. Can you confirm which process this exception is
coming from?

Based on the program logic, line 75 of ProcessStreamDrainerWorker.java
is only executed if asadmin start-domain is run without the --verbose
(or -v) option. Can you confirm that you are starting the domain
without --verbose?

If the process is started without the verbose option, then the asadmin
start-domain process should exit as soon as the server is up an running,
so the domain1-stderrdrainer thread shouldn't be around any more
(because the process has exited).

So is this exception happening while you are starting the server?

A little background about what this thread is for. When asadmin
start-domain starts the GlassFish DAS without the -v option, it reads
the output and error streams from the DAS while it is starting. If the
server starts successfully, the output, if any, is discarded. However,
if the server fails to start, then the start-domain command prints out a
message saying that the server failed to start, with the output that the
server generated while it was trying to start, so that it is available
for debugging purposes. So StringBuilder that is being appended to here
is capturing the output from stderr from the server.

Since the heap is overflowing, there must be lots and lots of output
from the server. You can see this output directly without saving it by
running start-domain with the --verbose option. This will keep
start-domain running for the life of the DAS, sending the output from
the DAS to your terminal window.

If the output from the server is expected, one way to avoid this issue
is to give the asadmin command more memory. The only way to do this is
to edit the asadmin script to add an appropriate -Xmx value.

Tom