* JDK 1.4.0-1 memory problems
@ 2002-11-01 6:57 Philip Yarra
2002-11-06 23:23 ` Philip Yarra
0 siblings, 1 reply; 2+ messages in thread
From: Philip Yarra @ 2002-11-01 6:57 UTC (permalink / raw)
Hi, I'm not sure if this is right forum for this, but here goes:
I have written a java console application, to be run on Tru64, designed to
stress-test one of our applications. It can potentially spawn a lot of
threads - on my Linux workstation I was getting OutOfMemoryErrors. After an
ugly workaround (see hackish code below) it runs quite well [on my
workstation]. Sooo... transferred the app over to the test Tru64 box. At
the really stressful part of the app (spawning a lot of threads) the VM
abruptly dies, with a range of console errors such as:
htable_insert: out of memory, file /util/htable.c, line 276
or
pool_alloc: out of memory, file /util/pool.c, line 117
or
array_enlarge: out of memory, file /util/sarray.c, line 37
...and sometimes it runs fine. Not often though!
The section of code that I think is bombing is
public void sendTransaction()
{
boolean spawned = false;
while(!spawned)
{
try
{
transactionThread tx = new transactionThread(this);
tx.start();
spawned = true;
}
catch(OutOfMemoryError oe)
{
try
{
Thread.sleep(100);
}
catch(InterruptedException e)
{}
}
catch(Throwable t)
{
System.err.println("sendTransaction: caught an exception");
t.printStackTrace(System.err);
System.exit(1);
}
}
It's entirely possible for this function to be executed 1000 times or so in
a row, resulting in a lot of threads... to the point where the VM on my
Linux box gave up (gracefully), hence the try and catch for
OutOfMemoryError. I kind of expected that Tru64 might also have trouble
spawning that many threads so rapidly, but expected that OutOfMemoryError
conditions would be caught by existing code.
Anyone got any ideas on this? It looks to me like a problem with the VM
implementation itself. I'd like to try an earler VM (1.3.x) but since this
app includes 1.4 specific code, I can't unless I rewrite it.
Other workarounds might be to manually limit (in Java) the number of allowed
threads, but I would prefer to avoid this, as it would necessarily be
arbitrary based on our Alpha's setup and some trial and error.
I also tried some playing around with thread stack size with -Xssn, but I
can't find a lot of doco about it (for example, what are the units? How
should the required amount be calculated? etc) The app did not bomb out
when I manually set -Xss, but it ran once, then never finished its second
run. It seemed to have hung badly. Since I had no real idea what to do with
this option, I stopped.
System details (mail me if you need more details)
$ sizer -v
Digital UNIX V4.0F (Rev. 1229)
$ java -version
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition
Fast VM (build 1.4.0-1, native threads, mixed mode, precompiled rt.jar,
09/05/2002-19:05)
Hoping someone out there might be using the same Java version on Tru64 and
be able to help.
Regards, Philip Yarra.
--
++real email address has netDOTau, not tenDOTau
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: JDK 1.4.0-1 memory problems
2002-11-01 6:57 JDK 1.4.0-1 memory problems Philip Yarra
@ 2002-11-06 23:23 ` Philip Yarra
0 siblings, 0 replies; 2+ messages in thread
From: Philip Yarra @ 2002-11-06 23:23 UTC (permalink / raw)
Philip Yarra wrote:
As a follow-up for those interested:
Further playing with -Xss options yielded a fix. It seems the default thread
stack size is a little too small for what I was trying to do. I am still
convinced there is a flaw in the Compaq VM implementation - perhaps at
small thread stack sizes the VM itself runs out of space, to the point
where it cannot allocate memory to throw an exception?
Anyway, running the app as follows:
java -Xss2048k -Xnoprecompiledsys classname options
seems to work pretty reliably. Bumping it up to -Xss4096k allows me to spin
out to 20,000 threads simultaneously (well, of course it doesn't actually
spin out 20,000 threads, but it is able to throw and catch
OutOfMemoryErrors, which is what I want).
I'm still unsure if such large thread stack size is good (I have read some
doco that suggests it may impede performance) but it seems to work.
Regards, Philip.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-11-06 23:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-01 6:57 JDK 1.4.0-1 memory problems Philip Yarra
2002-11-06 23:23 ` Philip Yarra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox