OutOfMemoryError - Any Way to Exit JVM?  
Author Message
sl





PostPosted: 2004-8-11 6:30:00 Top

java-programmer, OutOfMemoryError - Any Way to Exit JVM? Hi all,

We're having a major problem keeping Java calculators (that were
written by a third party vendor) alive. They leak memory and
eventually cause OutOfMemoryErrors. We cannot address the problem
directly until the vendor does, so we need to manage these dying
calculators.

Unfortunately, they are all started in separate processes and an
OutOfMemory error seems to kill *only* the thread, NOT the JVM. Is
there a way to ensure that the JVM dies as well?

My real hope is that some JVM has a command line option to kill the
whole thing when it has an allocation error. Otherwise, perhaps we can
add another thread to the process that watches it, but that's harder.

Any help would be greatly appreciated.

Thanks,
Steve Lieberman
 
Kenneth Stephen





PostPosted: 2004-8-11 8:18:00 Top

java-programmer >> OutOfMemoryError - Any Way to Exit JVM? Steve Lieberman wrote:

> Hi all,
>
> We're having a major problem keeping Java calculators (that were
> written by a third party vendor) alive. They leak memory and
> eventually cause OutOfMemoryErrors. We cannot address the problem
> directly until the vendor does, so we need to manage these dying
> calculators.
>
> Unfortunately, they are all started in separate processes and an
> OutOfMemory error seems to kill *only* the thread, NOT the JVM. Is
> there a way to ensure that the JVM dies as well?
>
> My real hope is that some JVM has a command line option to kill the
> whole thing when it has an allocation error. Otherwise, perhaps we can
> add another thread to the process that watches it, but that's harder.
>
Steve,

We tried doing this once. Eventually we came to the conclusion that it
was a foolish quest. Once an OutOfMemoryError occurs, nothing in the JVM
is trustworthy. The only safe thing to do at that point is to exit.

Regards,
Kenneth
 
Kenneth Stephen





PostPosted: 2004-8-11 8:26:00 Top

java-programmer >> OutOfMemoryError - Any Way to Exit JVM? Kenneth Stephen wrote:

> Steve Lieberman wrote:
>
>> Hi all,
>>
>> We're having a major problem keeping Java calculators (that were
>> written by a third party vendor) alive. They leak memory and
>> eventually cause OutOfMemoryErrors. We cannot address the problem
>> directly until the vendor does, so we need to manage these dying
>> calculators.
>>
>> Unfortunately, they are all started in separate processes and an
>> OutOfMemory error seems to kill *only* the thread, NOT the JVM. Is
>> there a way to ensure that the JVM dies as well?
>>
>> My real hope is that some JVM has a command line option to kill the
>> whole thing when it has an allocation error. Otherwise, perhaps we can
>> add another thread to the process that watches it, but that's harder.
>>
Steve,

My apologies. I just reread your question and I realize that I didnt
address your problem. Doesnt System.exit work for you?

Regards,
Kenneth
 
 
sl





PostPosted: 2004-8-11 21:14:00 Top

java-programmer >> OutOfMemoryError - Any Way to Exit JVM? Kenneth Stephen <email***@***.com> wrote in message news:<3IdSc.10774$email***@***.com>...
>
> My apologies. I just reread your question and I realize that I didnt
> address your problem. Doesnt System.exit work for you?


The problem is that the code for this dying process belongs to another
group. Is there a way to add a thread that watches for
OutOfMemoryErrors, or, even better, some way to cause the process to
die w/o even adding code at all?

Thanks,
Steve
 
 
Raymond DeCampo





PostPosted: 2004-8-12 8:53:00 Top

java-programmer >> OutOfMemoryError - Any Way to Exit JVM? Steve Lieberman wrote:
> Kenneth Stephen <email***@***.com> wrote in message news:<3IdSc.10774$email***@***.com>...
>
>> My apologies. I just reread your question and I realize that I didnt
>>address your problem. Doesnt System.exit work for you?
>
>
>
> The problem is that the code for this dying process belongs to another
> group. Is there a way to add a thread that watches for
> OutOfMemoryErrors, or, even better, some way to cause the process to
> die w/o even adding code at all?
>

You might be able to get some mileage out of the remote debugging API.

HTH,
Ray

--
XML is the programmer's duct tape.