You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2011/06/25 05:18:20 UTC

DO NOT REPLY [Bug 51432] New: NullPointerException happens when it costs more time on async processisng than async timeout value

https://issues.apache.org/bugzilla/show_bug.cgi?id=51432

             Bug #: 51432
           Summary: NullPointerException happens when it costs more time
                    on async processisng than async timeout value
           Product: Tomcat 7
           Version: 7.0.16
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: zhh200910@gmail.com
    Classification: Unclassified


In the example "examples\WEB-INF\classes\async\Async1.java",
if we change some value to let the sleeping time of the AsyncThread greater
than async timeout value, there will be a NullPointerException.
Please see the detailed information as the following:

java code:
====================================================================
    protected void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
        final AsyncContext actx = req.startAsync();
        actx.setTimeout(8*1000);
        Runnable run = new Runnable() {
            @Override
            public void run() {
                try {
                    String path = "/jsp/async/async1.jsp";
                    Thread.currentThread().setName("Async1-Thread");
                    log.info("Putting AsyncThread to sleep");
                    Thread.sleep(12*1000);
                    log.info("Dispatching to "+path);
                    actx.dispatch(path);
                }catch (InterruptedException x) {
                    log.error("Async1",x);
                }catch (IllegalStateException x) {
                    log.error("Async1",x);
                }
            }
        };
        Thread t = new Thread(run);
        t.start();
    }


error:
====================================================================
2011-6-25 10:32:11 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
2011-6-25 10:32:11 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
2011-6-25 10:32:11 org.apache.catalina.startup.Catalina start
信息: Server startup in 497 ms
2011-6-25 10:32:14 async.Async1$1 run
信息: Putting AsyncThread to sleep
2011-6-25 10:32:26 async.Async1$1 run
信息: Dispatching to /jsp/async/async1.jsp
Exception in thread "Async1-Thread" java.lang.NullPointerException
        at
org.apache.catalina.connector.Request.getServletContext(Request.java:1606)
        at
org.apache.catalina.core.AsyncContextImpl.dispatch(AsyncContextImpl.java:138)
        at async.Async1$1.run(Async1.java:49)
        at java.lang.Thread.run(Thread.java:619)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51432] NullPointerException happens when it costs more time on async processisng than async timeout value

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51432

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #2 from Mark Thomas <ma...@apache.org> 2011-06-28 17:23:38 UTC ---
The fix is the same and there is overlap in the issue reported so marking these
as duplicates.

*** This bug has been marked as a duplicate of bug 50353 ***

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51432] NullPointerException happens when it costs more time on async processisng than async timeout value

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51432

--- Comment #1 from Mark Thomas <ma...@apache.org> 2011-06-25 18:01:58 UTC ---
This is similar to bug 50353. Like that bug, as far as I can see, it is not
covered by the spec. I'm leaning towards throwing an IllegalStateExcpetion in
both cases.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org