Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003342 [Resin] minor always 02-15-09 10:16 02-25-09 14:29
Reporter stbu View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 3.1.9
Summary 0003342: Snapshot 3.1.s090206: NullPointerException in ServletConfigImpl
Description A NullPointerException like this is thrown, when a Web Application is stopped during a Servlet's <run-at> execution:

[2009-02-14 22:45:10.781] {resin-1} WARNING com.caucho.util.Alarm java.lang.NullPointerException
[2009-02-14 22:45:10.781] {resin-1} at com.caucho.server.dispatch.ServletConfigImpl.handleAlarm(ServletConfigImpl.java:606)
[2009-02-14 22:45:10.781] {resin-1} at com.caucho.util.Alarm.handleAlarm(Alarm.java:375)
[2009-02-14 22:45:10.781] {resin-1} at com.caucho.util.Alarm.run(Alarm.java:345)
[2009-02-14 22:45:10.781] {resin-1} at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:730)
[2009-02-14 22:45:10.781] {resin-1} at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:649)
[2009-02-14 22:45:10.781] {resin-1} at java.lang.Thread.run(Thread.java:595)


I've configured a Servlet with <run-at> interval of 5 minutes. On 22:45 the Web-Application was stopped by a Cron Job using a JMX Command Line Client. In the log I've seen the NullPointerException.
It seems it is getting caused in com.caucho.server.dispatch.ServletConfigImpl when the run-at is active and in this time the web-app is stopped.

604: } finally {
605: long nextTime = _runAt.getNextTimeout(Alarm.getCurrentTime());
606: _alarm.queue(nextTime - Alarm.getCurrentTime());
607: }

Additional Information Test case to reproduce it:

1.) Configure a Servlet with <run-at> in resin-web.xml

<web-app xmlns="http://caucho.com/ns/resin" [^]
         xmlns:resin="http://caucho.com/ns/resin/core"> [^]

  <servlet>
    <servlet-name>alarm</servlet-name>
    <servlet-class>test.TestAlarm</servlet-class>
    <run-at>:00, :05, :10, :15, :20, :25, :30, :35, :40, :45, :50, :55</run-at>
  </servlet>

</web-app>


2.) Servlet Class test.TestAlarm is this. I've put it into WEB-INF/classes for this simple testcase.

package test;

import javax.servlet.*;
import java.io.IOException;
import java.util.logging.Logger;

public class TestAlarm extends GenericServlet {
    protected static final Logger log
    = Logger.getLogger(TestAlarm.class.getName());

    public void service(ServletRequest request,
    ServletResponse response)
    throws IOException, ServletException
    {
        log.info(this + " start alarming");
        try {
            Thread.currentThread().sleep(15000);
        }
        catch(InterruptedException e) {
            log.warn(this + " interrupted");
         }
         log.info(this + " alarming finished");
     }
}


3.) When the <run-at> is fired, stop the Web-Application just after the " start alarming" message is displayed.

I did this with a JMX command line client.
java -jar cmdline-jmxclient-0.10.3.jar - localhost:9999 resin:type=WebApp,Host=default,name=/test-alarm stop

4.) When the <run-at> is finished, the NullPointerException is thrown.

[17:00:00.062] {resin-19} TestAlarm[WebApp[http://localhost:8080/test-alarm]] [^] start alarming
[17:00:03.421] {RMI TCP Connection(6)-192.168.1.100} WebApp[http://localhost:8080/test-alarm] [^] stopping
[17:00:15.062] {resin-19} TestAlarm[WebApp[http://localhost:8080/test-alarm]] [^] alarming finished
[17:00:15.062] {resin-19} java.lang.NullPointerException
[17:00:15.062] {resin-19} at com.caucho.server.dispatch.ServletConfigImpl.handleAlarm(ServletConfigImpl.java:606)
[17:00:15.062] {resin-19} at com.caucho.util.Alarm.handleAlarm(Alarm.java:375)
[17:00:15.062] {resin-19} at com.caucho.util.Alarm.run(Alarm.java:345)
[17:00:15.062] {resin-19} at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:730)
[17:00:15.062] {resin-19} at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:649)
[17:00:15.062] {resin-19} at java.lang.Thread.run(Thread.java:619)
Attached Files

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
02-15-09 10:16 stbu New Issue
02-15-09 10:16 stbu Issue Monitored: stbu
02-25-09 14:29 ferg Assigned To  => ferg
02-25-09 14:29 ferg Status new => closed
02-25-09 14:29 ferg Resolution open => fixed
02-25-09 14:29 ferg Fixed in Version  => 3.1.9


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed.
25 unique queries executed.
Powered by Mantis Bugtracker