Tomcat HTTPS NIO connector hits BufferOverflowException

Solution Verified - Updated -

Issue

  • After some hours of run time, we start seeing BufferOverflowExceptions like below and the cilent gets an empty orincomplete response:
java.nio.BufferOverflowException: null
    at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:363)
    at javax.crypto.CipherSpi.bufferCrypt(CipherSpi.java:836)
    at javax.crypto.CipherSpi.engineDoFinal(CipherSpi.java:730)
    at javax.crypto.Cipher.doFinal(Cipher.java:2460)
    at sun.security.ssl.CipherBox.encrypt(CipherBox.java:396)
    at sun.security.ssl.EngineOutputRecord.write(EngineOutputRecord.java:300)
    at sun.security.ssl.EngineOutputRecord.write(EngineOutputRecord.java:225)
    at sun.security.ssl.EngineWriter.writeRecord(EngineWriter.java:186)
    at sun.security.ssl.SSLEngineImpl.writeRecord(SSLEngineImpl.java:1300)
    at sun.security.ssl.SSLEngineImpl.writeAppRecord(SSLEngineImpl.java:1271)
    at sun.security.ssl.SSLEngineImpl.wrap(SSLEngineImpl.java:1186)
    at javax.net.ssl.SSLEngine.wrap(SSLEngine.java:469)
    at org.apache.tomcat.util.net.SecureNioChannel.write(SecureNioChannel.java:509)
    at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101)
    at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:172)
    at org.apache.coyote.http11.InternalNioOutputBuffer.writeToSocket(InternalNioOutputBuffer.java:139)
    at org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer.java:197)
    at org.apache.coyote.http11.InternalNioOutputBuffer.access$000(InternalNioOutputBuffer.java:41)
    at org.apache.coyote.http11.InternalNioOutputBuffer$SocketOutputBuffer.doWrite(InternalNioOutputBuffer.java:320)
    at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:118)
    at org.apache.coyote.http11.AbstractOutputBuffer.doWrite(AbstractOutputBuffer.java:256)
    at org.apache.coyote.Response.doWrite(Response.java:491)
    at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:391)
    at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:426)
    at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:345)
    at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:320)
    at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:110)

Environment

  • JBoss Enterprise Web Server (JWS) 3.1.0
    • Tomcat 8.0.36

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content