tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From HU E <E...@alcatel-lucent.com>
Subject NullPointerException is thrown when executing org.apache.coyote.http11.InternalNioOutputBuffer.writeToSocket
Date Tue, 18 Feb 2014 09:31:18 GMT
Dear all,

During performance and stability run, we encountered one tomcat issue, i.e. sometimes a NullPointerException
is thrown when executing org.apache.coyote.http11.InternalNioOutputBuffer.writeToSocket. This
issue was happened very rarely.

Following is the stack:
PRS0: Http response exception : java.lang.NullPointerException
org.apache.coyote.http11.InternalNioOutputBuffer.writeToSocket(InternalNioOutputBuffer.java:463)
org.apache.coyote.http11.InternalNioOutputBuffer.flushBuffer(InternalNioOutputBuffer.java:800)
org.apache.coyote.http11.InternalNioOutputBuffer.endRequest(InternalNioOutputBuffer.java:412)
org.apache.coyote.http11.Http11NioProcessor.action(Http11NioProcessor.java:1097)
org.apache.coyote.Response.action(Response.java:183)
org.apache.coyote.Response.finish(Response.java:305)
org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:284)
org.apache.catalina.connector.CoyoteWriter.close(CoyoteWriter.java:108)
....

The tomcat version is 6.0.35. I checked the source code, the exception occurred at line 463
of InternalNioOutputBuffer.java, which is marked in red.

private synchronized int writeToSocket(ByteBuffer bytebuffer, boolean block, boolean flip)
throws IOException {
......
......
try {
            written = getSelectorPool().write(bytebuffer, socket, selector, writeTimeout,
block,lastWrite);
            //make sure we are flushed
            do {
                if (socket.flush(true,selector,writeTimeout,lastWrite)) break;
            }while ( true );
        }finally {
            if ( selector != null ) getSelectorPool().put(selector);
        }

......
......
}

Before executing line 460 (i.e. written = getSelectorPool().write(bytebuffer, socket, selector,
writeTimeout, block,lastWrite)),socket object should not be null.

So I guess socket is recycled after executing line 460 so that NullPointException is thrown.
But I am not sure why the socket is recycled. Client closes the TCP connection? TCP write
timeout? TCP is reset?

I appreciate your help and thanks for your time in advance.

Thanks
Eric

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message