Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-1456

2 responses sent to bean client on bean invocation returning an exception, resulting in StreamCorruptedException under certain conditions

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Out of Date
    • Affects Version/s: No Release
    • Fix Version/s: 8.0.0.Alpha1
    • Component/s: EJB
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      timing related; however the problem in the code, that an unconditional
      2nd response is send it obvious an described above

      Show
      timing related; however the problem in the code, that an unconditional 2nd response is send it obvious an described above

      Description

      I've debugged that against EAP 6.0.1, but the symptom occurred for 7.1.1 as well:

      My test case throws a RuntimeException in the beans method body.

      I've experienced a strang behavior: if my junit test, that is the bean client, was executed within Eclipse, everything seemed to work fine on the client side. I debugged into the RiverUnmarshaller and it received the correctly deserialized exception, there were no attachments transmitted.

      When I executed the junit test case from ant, the RiverUnmarshaller threw an exception, here: java.io.EOFException: Read past end of file
      (I did also get StreamCorruptedExceptions if the exception was thrown in the commit phase rather than the method body).

      In both stack traces (EOFException and StreamCorruptedException) the problem occurred in org.jboss.ejb.client.remoting.ProtocolMessageHandler.readAttachments.

      When I debugged the client invoked from ant, I found, that like in Eclipse, first the exception is correctly deserialized, but then, it tries to read 57 attachments, but not a single byte follows (-> EOFException).

      The next step was, to debug into the server:
      org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler
      anonymous inner class #1, starts at about line 185:

      result = invokeMethod(invocationId, componentView, invokedMethod, methodParams, locator, attachments); //l.202

      throws an exception, this is handled:

      MethodInvocationMessageHandler.this.writeException(channelAssociation, MethodInvocationMessageHandler.this.marshallerFactory, invocationId, throwable, attachments); //l.206

      "attachments" is empty; a response message is created containing no attachments, this is the same for the Eclipse and ant invocation.

      The weird thing now is, regardless, that an exception was thrown and a response message written, in l. 238
      writeMethodInvocationResponse(channelAssociation, invocationId, result, attachments);
      another, second response is written. Containing "null" as result, and this time a single affinity object in the attachments.

      When run from Eclipse, this code executed fine, however the bean client seems to never read the second response.

      When run from ant, this code throws an exception:
      JBAS014560: Could not open message outputstream for writing to Channel
      and the client reads a corrupted first response, containing a valid exception and some nonsense thereafter.

      I blame the different behavior on different timings, for me it seems that the cause of the issue is, that in the exceptional case a second response is written, that should not be written.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                jaikiran Jaikiran Pai
                Reporter:
                cvk Christian von Kutzleben
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: