JBoss 5.1: strange problem with HTTP requests/responses
davidec Jun 18, 2013 4:28 AMHello!
I'm writing because we're facing a strange problem with an installation of an application we've developed.
The context: In a nutshell, we have a servlet which accepts http requests (no SSL in this installation) and responds with medical images, "generated" according to algorithms depending on the original image and on the parameters of the request. Each kind of generation is managed independently, from beginning to the end. This means that sometimes we use streams, sometimes writers, sometimes we use a memory buffer, sometimes not, and so on... Details are managed through libraries, which might be the cause of the problem or not, but delving into the libraries seems too much to face here.
The problem: In this particular installation we're using three JBoss servers (version 5.1.0 running on the latest patch of RedHat Enterprise 5), two of which are behind an Apache balancer and one is accessed directly.
All servers receive "many" requests, but the degree of concurrency seems not to exceed 5 contemporary requests. Typically a client performs many sequential requests of different images.
Some of the requests fail due to various exceptions, of which below are the parts not concerning the particular libraries we use. Please be aware that requesting a failed image again correctly returns the image, that no clients abort connections, that no timeout occurs on their side and that below are pieces from 4 different stacktraces:
-----
java.lang.NullPointerException
at org.apache.tomcat.util.http.MimeHeaders.setValue(MimeHeaders.java:382)
at org.apache.coyote.http11.Http11Processor.prepareResponse(Http11Processor.java:1498)
at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:921)
at org.apache.coyote.Response.action(Response.java:184)
at org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:550)
at org.apache.coyote.Response.doWrite(Response.java:567)
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:394)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:449)
at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:428)
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:411)
at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89)
...
2013-06-17 11:41:12,898 ERROR [org.apache.catalina.connector.CoyoteAdapter] An exception or error occurred in the container during the request processing
java.lang.NullPointerException
at org.apache.tomcat.util.http.MimeHeaders.setValue(MimeHeaders.java:382)
at org.apache.coyote.http11.Http11Processor.prepareResponse(Http11Processor.java:1498)
at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:921)
at org.apache.coyote.Response.action(Response.java:186)
at org.apache.coyote.Response.sendHeaders(Response.java:386)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:331)
at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:299)
at org.apache.catalina.connector.Response.finishResponse(Response.java:493)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:662)
2013-06-17 11:41:12,898 ERROR [org.apache.coyote.http11.Http11Processor] Error finishing response
java.lang.NullPointerException
at org.apache.tomcat.util.http.MimeHeaders.setValue(MimeHeaders.java:382)
at org.apache.coyote.http11.Http11Processor.prepareResponse(Http11Processor.java:1498)
at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:921)
at org.apache.coyote.Response.action(Response.java:184)
at org.apache.coyote.http11.InternalOutputBuffer.endRequest(InternalOutputBuffer.java:363)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:662)
2013-06-17 11:41:12,899 ERROR [org.apache.coyote.http11.Http11Protocol] Error reading request, ignored
java.lang.NullPointerException
at org.apache.tomcat.util.http.MimeHeaders.clear(MimeHeaders.java:248)
at org.apache.coyote.Response.recycle(Response.java:586)
at org.apache.coyote.http11.InternalOutputBuffer.nextRequest(InternalOutputBuffer.java:333)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:887)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:662)
-----
ClientAbortException: java.net.SocketException: Broken pipe
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:399)
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:325)
at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:422)
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:411)
at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89)
...
Caused by: java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:724)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:449)
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:349)
at org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:748)
at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:126)
at org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:557)
at org.apache.coyote.Response.doWrite(Response.java:567)
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:394)
... 36 more
-----
ClientAbortException: java.net.SocketException: Broken pipe
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:399)
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:354)
at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:422)
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:411)
at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89)
...
Caused by: java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:724)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:449)
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:349)
at org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:748)
at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:126)
at org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:557)
at org.apache.coyote.Response.doWrite(Response.java:567)
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:394)
... 31 more
-----
java.lang.ArrayIndexOutOfBoundsException
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:346)
at org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:748)
at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:129)
at org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:557)
at org.apache.coyote.Response.doWrite(Response.java:567)
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:394)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:449)
at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:428)
at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:411)
at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89)
...
-----
We have many similar installations of the same application and we're not facing the problem anywhere else (yet?).
Does anyone know what the problem might be? Or at least in what direction to perform further analysis? I'm stuck! It looks like we're not writing on the correct response (it seems to me to be closed or using a buffer of wrong dimensions), but in our code and in the libraries we can't find shared resources.
Please, any help would be appreciated!
Of course, if the context is not clear, I'm available for further questions.
Thank you in advance!
Davide
PS: It might be connected to https://issues.jboss.org/browse/JBREM-1267, but it is rather vague...