users@glassfish.java.net

Re: Anyone successfully run Quercus/PHP on GF?

From: <glassfish_at_javadesktop.org>
Date: Fri, 16 Oct 2009 12:07:02 PDT

I've run into the same issue with Glassfish v2.1 and Quercus 4.0.1. This doesn't happen the first time the app server is started, but only happens if the application is undeployed and redeployed. When it happens, the only recourse is to restart glassfish. This happens every time I make a change to our application and redeploy.

I have filed an issue on Quercus' forums about this, and they accepted it as a bug:

http://forum.caucho.com/showthread.php?t=1517
http://bugs.caucho.com/view.php?id=3711

By inspecting the Quercus 4.0.1 source, code, I found the offending line in com.caucho.util.Alarm.java:

      Alarm []heap = _heap;

      Alarm alarm = heap[1];

The exception (which occurs in the 2nd line) implies that _heap is null, but it's not obvious from the code how it got to be null. It is declared this way:

  private static Alarm []_heap = new Alarm[256];

The only times in the code that _heap is modified is (in insertImpl method):

    // resize if necessary
    if (_heap.length <= _heapTop + 2) {
      Alarm []newHeap = new Alarm[2 * _heap.length];
      System.arraycopy(_heap, 0, newHeap, 0, _heap.length);
      _heap = newHeap;
    }

I haven't had time to dig into this further, for now, to avoid the tight loop of exceptions, I added this code immediately before the statement causing the exception:

      if(_heap == null) {
              log.log(Level.WARNING, "extractAlarm: heap is null, creating new heap. ");
          _heap = new Alarm[256];
      }

Good enough for me for now. I hope this helps.

Regards,
Ari Shamash
[Message sent by forum member 'ashamash' (ari.shamash_at_sun.com)]

http://forums.java.net/jive/thread.jspa?messageID=368264