tyrus
  1. tyrus
  2. TYRUS-151

Getting java.nio.BufferUnderflowException or sometimes NPE in InputStream onMessage() communication

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      The following test:

      mvn -Dtest=LifeCycleAnnotatedObjectInputStreamTest clean install

      is sometimes causing this exception to happen or alternatively NPE thrown @org.glassfish.tyrus.core.InputStreamBuffer.getNextByte(InputStreamBuffer.java:99)

      java.nio.BufferUnderflowException
      at java.nio.Buffer.nextGetIndex(Buffer.java:492)
      at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:135)
      at org.glassfish.tyrus.core.InputStreamBuffer.getNextByte(InputStreamBuffer.java:99)
      at org.glassfish.tyrus.core.BufferedInputStream.read(BufferedInputStream.java:65)
      at java.io.InputStream.read(InputStream.java:179)
      at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2283)
      at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2296)
      at java.io.ObjectInputStream$BlockDataInputStream.readUTFBody(ObjectInputStream.java:3036)
      at java.io.ObjectInputStream$BlockDataInputStream.readUTF(ObjectInputStream.java:2837)
      at java.io.ObjectInputStream.readString(ObjectInputStream.java:1617)
      at java.io.ObjectInputStream.readTypeString(ObjectInputStream.java:1419)
      at java.io.ObjectStreamClass.readNonProxy(ObjectStreamClass.java:692)
      at java.io.ObjectInputStream.readClassDescriptor(ObjectInputStream.java:827)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1514)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
      at org.glassfish.tyrus.tests.qa.lifecycle.handlers.ObjectInputStreamSessionImpl.onServerMessageHandler(ObjectInputStreamSessionImpl.java:94)
      at org.glassfish.tyrus.tests.qa.lifecycle.handlers.ObjectInputStreamSessionImpl.onServerMessageHandler(ObjectInputStreamSessionImpl.java:58)
      at org.glassfish.tyrus.tests.qa.lifecycle.SessionLifeCycle.onServerMessage(SessionLifeCycle.java:143)
      at org.glassfish.tyrus.tests.qa.lifecycle.handlers.binary.AnnotatedWholeMessageObjectInputStreamSession$Server.onMessage(AnnotatedWholeMessageObjectInputStreamSession.java:85)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.glassfish.tyrus.core.AnnotatedEndpoint.callMethod(AnnotatedEndpoint.java:431)
      at org.glassfish.tyrus.core.AnnotatedEndpoint.access$100(AnnotatedEndpoint.java:83)
      at org.glassfish.tyrus.core.AnnotatedEndpoint$WholeHandler$1.onMessage(AnnotatedEndpoint.java:518)
      at org.glassfish.tyrus.core.InputStreamBuffer$1.run(InputStreamBuffer.java:134)
      Mar 20, 2013 7:30:21 PM org.glassfish.tyrus.tests.qa.lifecycle.SessionLifeCycle onServerMessage
      SEVERE: null
      java.nio.BufferUnderflowException
      at java.nio.Buffer.nextGetIndex(Buffer.java:492)
      at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:135)
      at org.glassfish.tyrus.core.InputStreamBuffer.getNextByte(InputStreamBuffer.java:99)
      at org.glassfish.tyrus.core.BufferedInputStream.read(BufferedInputStream.java:65)
      at java.io.InputStream.read(InputStream.java:179)
      at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2283)
      at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2296)
      at java.io.ObjectInputStream$BlockDataInputStream.readUTFBody(ObjectInputStream.java:3036)
      at java.io.ObjectInputStream$BlockDataInputStream.readUTF(ObjectInputStream.java:2837)
      at java.io.ObjectInputStream.readString(ObjectInputStream.java:1617)
      at java.io.ObjectInputStream.readTypeString(ObjectInputStream.java:1419)
      at java.io.ObjectStreamClass.readNonProxy(ObjectStreamClass.java:692)
      at java.io.ObjectInputStream.readClassDescriptor(ObjectInputStream.java:827)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1514)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
      at org.glassfish.tyrus.tests.qa.lifecycle.handlers.ObjectInputStreamSessionImpl.onServerMessageHandler(ObjectInputStreamSessionImpl.java:94)
      at org.glassfish.tyrus.tests.qa.lifecycle.handlers.ObjectInputStreamSessionImpl.onServerMessageHandler(ObjectInputStreamSessionImpl.java:58)
      at org.glassfish.tyrus.tests.qa.lifecycle.SessionLifeCycle.onServerMessage(SessionLifeCycle.java:143)
      at org.glassfish.tyrus.tests.qa.lifecycle.handlers.binary.AnnotatedWholeMessageObjectInputStreamSession$Server.onMessage(AnnotatedWholeMessageObjectInputStreamSession.java:85)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.glassfish.tyrus.core.AnnotatedEndpoint.callMethod(AnnotatedEndpoint.java:431)
      at org.glassfish.tyrus.core.AnnotatedEndpoint.access$100(AnnotatedEndpoint.java:83)
      at org.glassfish.tyrus.core.AnnotatedEndpoint$WholeHandler$1.onMessage(AnnotatedEndpoint.java:518)
      at org.glassfish.tyrus.core.InputStreamBuffer$1.run(InputStreamBuffer.java:134)

        Activity

        Hide
        stepan.kopriva added a comment -

        Fixed by synchronizing InputStreamBuffer

        Show
        stepan.kopriva added a comment - Fixed by synchronizing InputStreamBuffer

          People

          • Assignee:
            stepan.kopriva
            Reporter:
            mikc22
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: