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 2008/08/07 21:35:39 UTC

DO NOT REPLY [Bug 45591] New: NullPointerException during shutdown in JKMain.pause()

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

           Summary: NullPointerException during shutdown in JKMain.pause()
           Product: Tomcat 5
           Version: 5.5.20
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Connector:AJP
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: mpassell@grovehillsoftware.com
                CC: mpassell@grovehillsoftware.com


On startup, if Tomcat discovers that the main port is already bound to another
process, it fails and tries to execute the shutdown code.  In some situations
(I'm not sure which), the org.apache.jk.server.JKMain instance variable wEnv is
null at this point, which causes a NullPointerException when JKMain.pause() is
called (see stacktrace below).  Since this is occurring within a shutdown hook
thread, it can result in a dirty shutdown of the JVM.  I've observed this with
Tomcat 5.5.20, but I looked over the code in 5.5.26 and it looks like the same
problem is still present.

Fortunately, the solution is very simple.  Just add the following if test at
the beginning of JKMain.pause():

        if (wEnv == null) {
          return;
        }


Stacktrace:
SEVERE: StandardServer.await: create[8006]: 
java.net.BindException: Address already in use: JVM_Bind
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
        at java.net.ServerSocket.bind(ServerSocket.java:319)
        at java.net.ServerSocket.<init>(ServerSocket.java:185)
        at
org.apache.catalina.core.StandardServer.await(StandardServer.java:372)
        at org.apache.catalina.startup.Catalina.await(Catalina.java:615)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
Aug 7, 2008 3:25:34 PM org.apache.coyote.http11.Http11BaseProtocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8000
Aug 7, 2008 3:25:34 PM org.apache.catalina.connector.Connector pause
SEVERE: Protocol handler pause failed
java.lang.NullPointerException
        at org.apache.jk.server.JkMain.pause(JkMain.java:678)
        at org.apache.jk.server.JkCoyoteHandler.pause(JkCoyoteHandler.java:162)
        at org.apache.catalina.connector.Connector.pause(Connector.java:1031)
        at
org.apache.catalina.core.StandardService.stop(StandardService.java:491)
        at
org.apache.catalina.core.StandardServer.stop(StandardServer.java:743)
        at org.apache.catalina.startup.Catalina.stop(Catalina.java:601)
        at
org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run(Catalina.java:644)


-- 
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 45591] NullPointerException during shutdown in JKMain.pause()

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





--- Comment #2 from Matt Passell <mp...@grovehillsoftware.com>  2008-08-08 08:23:53 PST ---
(In reply to comment #1)
> Thanks for the report and patch. I have committed a slightly different version
> to trunk and proposed it for 6.0.x and 5.5.x


Thanks!

--Matt


-- 
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 45591] NullPointerException during shutdown in JKMain.pause()

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





--- Comment #1 from Mark Thomas <ma...@apache.org>  2008-08-08 07:36:34 PST ---
Thanks for the report and patch. I have committed a slightly different version
to trunk and proposed it for 6.0.x and 5.5.x


-- 
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 45591] NullPointerException during shutdown in JKMain.pause()

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


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

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




--- Comment #4 from Mark Thomas <ma...@apache.org>  2008-08-27 13:58:02 PST ---
This has been fixed in 5.5.x and will be included in 5.5.27 onwards.


-- 
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 45591] NullPointerException during shutdown in JKMain.pause()

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





--- Comment #3 from Mark Thomas <ma...@apache.org>  2008-08-13 15:35:47 PST ---
This has been fixed in 6.0.x and will be included in 6.0.19 onwards.


-- 
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