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/06 14:52:26 UTC

DO NOT REPLY [Bug 45580] New: Unhandled NullPointerException when trying to write to a closed socket.

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

           Summary: Unhandled NullPointerException when trying to write to a
                    closed socket.
           Product: Tomcat 6
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: friendpadma@gmail.com


Description of the scenario:

Consider a client using web Messaging service with NIOConnector configured.
Suppose if the client is closed by the time server writes the response to the
socket, it throws a NPE. It appears that there is no check for the null socket
condition. I think the addition of a null check will correct this.

The stack trace of the exception is: 

[ActiveMQMessageConsumer] Exception while processing message:
java.lang.NullPointerException
java.lang.NullPointerException
        at
org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer.java:607)
        at
org.apache.coyote.http11.InternalNioOutputBuffer.commit(InternalNioOutputBuffer.java:600)
        at
org.apache.coyote.http11.Http11NioProcessor.action(Http11NioProcessor.java:1034)
        at org.apache.coyote.Response.action(Response.java:183)
        at org.apache.coyote.Response.sendHeaders(Response.java:379)
        at
org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:305)
        at
org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:273)
        at
org.apache.catalina.connector.CoyoteOutputStream.close(CoyoteOutputStream.java:104)


-- 
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 45580] Unhandled NullPointerException when trying to write to a closed socket.

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


Filip Hanik <fh...@apache.org> changed:

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




--- Comment #1 from Filip Hanik <fh...@apache.org>  2008-08-06 13:54:23 PST ---
The NPE is only because of an incorrectly used response object. if you are
trying to write to a response that has been closed, in a different thread, it
is better for you to fix the application that is doing that. 

There are simply too many NPE checks to do to catch all such scenarios, and
they essentially don't do anything, they would just convert the NPE to a
IOException.

If you believe the error comes from correct usage of the response, then please
elaborate a little bit on how this happens, and we can apply a correct fix.

best
Filip


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