java.nio.BufferOverflowException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • GitHub comment 1078#273209534
    via GitHub by mattnworb
    ,
  • Emitting large data with SSE can cause a BufferOverflowException. {code} ! java.nio.BufferOverflowException: null ! at java.nio.Buffer.nextPutIndex(Buffer.java:513) ~[na:1.7.0_65] ! at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:163) ~[na:1.7.0_65] ! at org.eclipse.jetty.util.BufferUtil.append(BufferUtil.java:377) ~[queryserver.jar:na]! at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:231) ~[queryserver.jar:na] ! at org.glassfish.jersey.servlet.internal.ResponseWriter$NonCloseableOutputStreamWrapper.write(ResponseWriter.java:289) ~[queryserver.jar:na]! at org.glassfish.jersey.message.internal.CommittingOutputStream.write(CommittingOutputStream.java:244) ~[queryserver.jar:na] ! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$UnCloseableOutputStream.write(WriterInterceptorExecutor.java:289) ~[queryserver.jar:na] ! at org.glassfish.jersey.media.sse.OutboundEventWriter$1.write(OutboundEventWriter.java:152) ~[queryserver.jar:na] ! at java.io.OutputStream.write(OutputStream.java:116) ~[na:1.7.0_65] ! at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221) ~[na:1.7.0_65] ! at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291) ~[na:1.7.0_65] ! at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295) ~[na:1.7.0_65] ! at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141) ~[na:1.7.0_65] ! at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229) ~[na:1.7.0_65] ! at org.glassfish.jersey.message.internal.ReaderWriter.writeToAsString(ReaderWriter.java:190) ~[queryserver.jar:na] ! at org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider.writeToAsString(AbstractMessageReaderWriterProvider.java:130) ~[queryserver.jar:n a] ! at org.glassfish.jersey.message.internal.StringMessageProvider.writeTo(StringMessageProvider.java:99) ~[queryserver.jar:na] ! at org.glassfish.jersey.message.internal.StringMessageProvider.writeTo(StringMessageProvider.java:59) ~[queryserver.jar:na] ! at org.glassfish.jersey.media.sse.OutboundEventWriter.writeTo(OutboundEventWriter.java:135) ~[queryserver.jar:na] ! at org.glassfish.jersey.media.sse.OutboundEventWriter.writeTo(OutboundEventWriter.java:65) ~[queryserver.jar:na] ! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265) ~[queryserver.jar:na] ! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250) ~[queryserver.jar:na] ! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) ~[queryserver.jar:na] ! at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1128) ~[queryserver.jar:na] ! at org.glassfish.jersey.server.ChunkedOutput$1.call(ChunkedOutput.java:219) ~[queryserver.jar:na] ! at org.glassfish.jersey.server.ChunkedOutput$1.call(ChunkedOutput.java:190) ~[queryserver.jar:na] ! at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[queryserver.jar:na] ! at org.glassfish.jersey.internal.Errors.process(Errors.java:242) ~[queryserver.jar:na] ! at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:367) ~[queryserver.jar:na] ! at org.glassfish.jersey.server.ChunkedOutput.flushQueue(ChunkedOutput.java:190) ~[queryserver.jar:na] ! at org.glassfish.jersey.server.ChunkedOutput.write(ChunkedOutput.java:180) ~[queryserver.jar:na] {code}
    via by panghy,
  • [ForkJoinPool-1-worker-4] ERROR
    via GitHub by programaths
    ,
  • Emitting large data with SSE can cause a BufferOverflowException. {code} ! java.nio.BufferOverflowException: null ! at java.nio.Buffer.nextPutIndex(Buffer.java:513) ~[na:1.7.0_65] ! at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:163) ~[na:1.7.0_65] ! at org.eclipse.jetty.util.BufferUtil.append(BufferUtil.java:377) ~[queryserver.jar:na]! at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:231) ~[queryserver.jar:na] ! at org.glassfish.jersey.servlet.internal.ResponseWriter$NonCloseableOutputStreamWrapper.write(ResponseWriter.java:289) ~[queryserver.jar:na]! at org.glassfish.jersey.message.internal.CommittingOutputStream.write(CommittingOutputStream.java:244) ~[queryserver.jar:na] ! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$UnCloseableOutputStream.write(WriterInterceptorExecutor.java:289) ~[queryserver.jar:na] ! at org.glassfish.jersey.media.sse.OutboundEventWriter$1.write(OutboundEventWriter.java:152) ~[queryserver.jar:na] ! at java.io.OutputStream.write(OutputStream.java:116) ~[na:1.7.0_65] ! at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221) ~[na:1.7.0_65] ! at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291) ~[na:1.7.0_65] ! at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295) ~[na:1.7.0_65] ! at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141) ~[na:1.7.0_65] ! at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229) ~[na:1.7.0_65] ! at org.glassfish.jersey.message.internal.ReaderWriter.writeToAsString(ReaderWriter.java:190) ~[queryserver.jar:na] ! at org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider.writeToAsString(AbstractMessageReaderWriterProvider.java:130) ~[queryserver.jar:n a] ! at org.glassfish.jersey.message.internal.StringMessageProvider.writeTo(StringMessageProvider.java:99) ~[queryserver.jar:na] ! at org.glassfish.jersey.message.internal.StringMessageProvider.writeTo(StringMessageProvider.java:59) ~[queryserver.jar:na] ! at org.glassfish.jersey.media.sse.OutboundEventWriter.writeTo(OutboundEventWriter.java:135) ~[queryserver.jar:na] ! at org.glassfish.jersey.media.sse.OutboundEventWriter.writeTo(OutboundEventWriter.java:65) ~[queryserver.jar:na] ! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265) ~[queryserver.jar:na] ! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250) ~[queryserver.jar:na] ! at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) ~[queryserver.jar:na] ! at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1128) ~[queryserver.jar:na] ! at org.glassfish.jersey.server.ChunkedOutput$1.call(ChunkedOutput.java:219) ~[queryserver.jar:na] ! at org.glassfish.jersey.server.ChunkedOutput$1.call(ChunkedOutput.java:190) ~[queryserver.jar:na] ! at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[queryserver.jar:na] ! at org.glassfish.jersey.internal.Errors.process(Errors.java:242) ~[queryserver.jar:na] ! at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:367) ~[queryserver.jar:na] ! at org.glassfish.jersey.server.ChunkedOutput.flushQueue(ChunkedOutput.java:190) ~[queryserver.jar:na] ! at org.glassfish.jersey.server.ChunkedOutput.write(ChunkedOutput.java:180) ~[queryserver.jar:na] {code}
    via by panghy,
  • Does not show RAW XML data
    via Stack Overflow by Haziq Sheikh
    ,
  • Bug reported at http://mail.openjdk.java.net/pipermail/security-dev/2016-February/013387.html ---------------------------------------------------------- Hi, while supporting an app development team, I'm facing a tough TLS issue - maybe you experts have an idea. They try to open an HTTPS connection to the server URL https://nfe-homologacao.sefazrs.rs.gov.br:443/ws/NfeAutorizacao/NFeAutorizacao.asmx. This is a Web Service of some Brazilian financial authority. So, what I'm basically doing is this: --code snippet-- URL url = new URL("https://nfe-homologacao.sefazrs.rs.gov.br:443/ws/NfeAutorizacao/NFeAutorizacao.asmx"); HttpsURLConnection con = (HttpsURLConnection)url.openConnection(); con.setHostnameVerifier(new DefaultHostnameVerifier()); // optional default is GET con.setRequestMethod("GET"); System.out.println("Sending 'GET' request to URL: " + url); int responseCode = con.getResponseCode(); System.out.println("Response Code: " + responseCode); --end code snippet- I expect it to return "403 - not authorized". The coding will work with JDK7. However, with JDK8, I get this type of exception: java.net.SocketException: Unrecognized Windows Sockets error: 0: recv failed at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) at java.net.SocketInputStream.read(SocketInputStream.java:170) at java.net.SocketInputStream.read(SocketInputStream.java:141) at sun.security.ssl.InputRecord.readFully(InputRecord.java:465) at sun.security.ssl.InputRecord.read(InputRecord.java:503) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973) at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:930) at sun.security.ssl.AppInputStream.read(AppInputStream.java:105) at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) at java.io.BufferedInputStream.read(BufferedInputStream.java:345) at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:704) at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647) at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:675) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1536) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338) ... I can get it to work in JDK8 by forcing it to TLSv1 only, e.g. by setting property -Djdk.tls.client.protocols=TLSv1. For JDK9 I even get a different exception: javax.net.ssl.SSLException: java.nio.BufferOverflowException at sun.security.ssl.Alerts.getSSLException(Alerts.java:214) at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1948) at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1900) at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1883) at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1809) at sun.security.ssl.AppInputStream.read(AppInputStream.java:173) at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) at java.io.BufferedInputStream.read(BufferedInputStream.java:345) at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:704) at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647) at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:675) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1534) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:319) at com.sap.cl.HttpsURLConnectionTest.sendGETRequest(HttpsURLConnectionTest.java:42) at com.sap.cl.HttpsURLConnectionTest.main(HttpsURLConnectionTest.java:63) Caused by: java.nio.BufferOverflowException at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:206) at sun.security.ssl.SSLSocketInputRecord.decodeInputRecord(SSLSocketInputRecord.java:226) at sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:178) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1012) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:957) at sun.security.ssl.AppInputStream.read(AppInputStream.java:159) ... 12 more I've debugged a lot today and tried to get something out of the javax.net.debug output but I didn't get any further with this - probably due to my lack of understanding the details of TLS communication and its implementation. I know the server is using some legacy protocol but still I think it should work. Maybe someone has any helpful idea? Is it a bug? You can simply try to run my test code snippet and should see the issue immediately... Thanks Christoph
    via by Xue-Lei Fan,
    • java.nio.BufferOverflowException: null at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:206) at com.spotify.helios.testing.LoggingLogStreamFollower.followLog(LoggingLogStreamFollower.java:83) at com.spotify.helios.testing.HeliosSoloLogService$LogFollowJob.call(HeliosSoloLogService.java:150) at com.spotify.helios.testing.HeliosSoloLogService$LogFollowJob.call(HeliosSoloLogService.java:135) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

    Users with the same issue

    Sreekesh Alwayswithyourvision
    1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    3 more bugmates