Lingo
  1. Lingo
  2. LINGO-37

Race condition with ResultJoinStrategy causes premature result returns

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.3
    • Labels:
      None
    • Number of attachments :
      4

      Description

      There is a subtle race condition in JMSClientInterceptor:

      ResultJoinHandler handler = createResultJoinHandler(methodInvocation, metadata);
      // send request to topic
      requestor.request(destination, requestMessage, handler, getMultipleResponseTimeout());
      // race to here if the response comes back fast
      RemoteInvocationResult result = handler.waitForResult();
      return recreateRemoteInvocationResult(result);

      due to a bug in the ResultJoinHandler methods:

      public RemoteInvocationResult waitForResult() {
      while (true) {
      synchronized (lock) {
      if (result != null)

      { return result; }

      If the onMessage result could have been already called before we call waitForResult and so result could be != null but the unblockCallerThread could still return false.

      I've attached a patch which fixes the problem. Few of the unit tests work for me because of outside dependencies so I'm not sure how to best test this issue.

      1. lingo.patch
        5 kB
        Gray
      2. lingo.patch
        5 kB
        Gray
      3. ResultJoinHandler.java.diff
        2 kB
        Gray
      4. ResultJoinHandler.java.patch
        1 kB
        Gray

        Issue Links

          Activity

          Hide
          james strachan added a comment -

          Patch applied - many thanks!

          Show
          james strachan added a comment - Patch applied - many thanks!
          Hide
          Gray added a comment -

          Okay. So this fixes a small problem with the previous patch. Can someone please remove all of the other patches. A couple are just wrong.

          Show
          Gray added a comment - Okay. So this fixes a small problem with the previous patch. Can someone please remove all of the other patches. A couple are just wrong.
          Hide
          james strachan added a comment -

          Gray - its getting confusing with 4 patches on the go Could you create another patch off the current SVN trunk so I know which parts are changing after applying the previous patch?

          Show
          james strachan added a comment - Gray - its getting confusing with 4 patches on the go Could you create another patch off the current SVN trunk so I know which parts are changing after applying the previous patch?
          Hide
          james strachan added a comment -

          BTW as seen as 1.3 has been released, we should probably reopen another JIRA for turther patches

          Show
          james strachan added a comment - BTW as seen as 1.3 has been released, we should probably reopen another JIRA for turther patches
          Hide
          Gray added a comment -

          Sorry for the multiple patches. I would have deleted the old ones if I could. If it was going right into 1.3 then I would have reviewed it better.

          Show
          Gray added a comment - Sorry for the multiple patches. I would have deleted the old ones if I could. If it was going right into 1.3 then I would have reviewed it better.

            People

            • Assignee:
              Unassigned
              Reporter:
              Gray
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: