From: Philip Yarra <philip@cpc.ten.au>
Subject: JDK 1.4.0-1 memory problems
Date: Fri, 01 Nov 2002 17:57:59 +1100 [thread overview]
Message-ID: <3dc22636_1@news.iprimus.com.au> (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
next reply other threads:[~2002-11-01 6:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-01 6:57 Philip Yarra [this message]
2002-11-06 23:23 ` JDK 1.4.0-1 memory problems Philip Yarra
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox