I am running the sun version:
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

I get multiple Out of memory exceptions looking at my application and the
solr logs, but my script doesn't get called the first time or other times,
hence why I was thinking that maybe solr is doing something different.  My
script notifies me  of the memory exception and then restarts the jvm.
 Running the script manually works fine. I'll try to do some more testing to
see what exactly is going on.

Jason

On Wed, Sep 21, 2011 at 2:31 PM, Chris Hostetter
<hossman_luc...@fucit.org>wrote:

>
> : Usually any good piece of java code refrains from capturing Throwable
> : so that Errors will bubble up unlike exceptions. Having said that,
>
> Even if some piece of code catches an OutOfMemoryError, the JVM should
> have already called the "-XX:OnOutOfMemoryError" hook - Although from what
> i can tell, the JVM will only call the hook on hte *first* OOM thrown
>
> (you can try the code below to test this behavior in your own JVM)
>
> : > I'm trying to be notified when the error occurs.  I saw with the jvm I
> can
> : > pass the -XX:OnOutOfMemoryError= flag and pass a script to run. Every
> time
> : > the out of memory issue occurs though my script never runs. Does solr
> let
>
> ...exactly what JVM are you running?  this option is specific to the
> Sun/Oracle JVM.  For example, in the IBM JVM, there is a completley
> different mechanism...
>
>
> http://stackoverflow.com/questions/3467219/is-there-something-like-xxonerror-or-xxonoutofmemoryerror-in-ibm-jvm
>
>
> ------ Simple OnOutOfMemoryError hook test -----
> import static java.lang.System.out;
> import java.util.ArrayList;
> public final class Test {
>  public static void main(String... args) throws Exception {
>    ArrayList data = new ArrayList<Object>(1000);
>    for (int i=0; i<5; i++) {
>      try {
>        while (i < 5) {
>          data.add(new ArrayList<Integer>(100000));
>        }
>      } catch (OutOfMemoryError oom) {
>        data.clear();
>        out.println("caught");
>      }
>    }
>  }
> }
> ------ example of running it -------
> hossman@bester:~/tmp$ java -version
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
> hossman@bester:~/tmp$ java -XX:OnOutOfMemoryError="echo HOOK" -Xmx64M Test
> #
> # java.lang.OutOfMemoryError: Java heap space
> # -XX:OnOutOfMemoryError="echo HOOK"
> #   Executing /bin/sh -c "echo HOOK"...
> HOOK
> caught
> caught
> caught
> caught
> caught
> hossman@bester:~/tmp$
> ------------------------------------------
>
>
>
> -Hoss




-- 
- sent from my mobile
6176064373

Reply via email to