Uploaded image for project: 'JBoss Transaction Manager'
  1. JBoss Transaction Manager
  2. JBTM-3331

LRA end should not return internal server error when precondition fails as it's considered behaviour by spec

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 5.10.5.Final
    • Fix Version/s: 5.next
    • Component/s: LRA
    • Labels:
      None

      Description

      I've spent some time with https://issues.redhat.com/browse/JBTM-3318 recently and I have a doubt about behaviour of the LRA. The JBTM-3318 consists of race condition on starting/enlisting/timeouting the LRA.
      The same issue makes failing the `TckTests#timeLimit` and `TckRecoveryTests#testCancelWhenParticipantIsUnavailable` on our slow AMS CI.
      I don't want to talk now about the TCK failure but about the related behaviour of the Narayana implementation.

      The LRA participant defines the timeLimit (https://github.com/eclipse/microprofile-lra/blob/1.0-M1/tck/src/main/java/org/eclipse/microprofile/lra/tck/participant/api/LraResource.java#L404).
      And what happens is that the client (TCK test) calls the LRA method, the JAX-RS filter starts a LRA on coordinator, meanwhile the timeout limit elapses, the JAX-RS filter tries to enlist the LRA participant to started LRA but it fails as the LRA was cancelled because of timeout.
      Now. The possible non-deterministic Narayana behaviour is that in case of failure on LRA participant enlistment the client may or may not get internal server error.
      It's because the LRA in timeouted state on client is tried to be cancelled (see https://github.com/jbosstm/narayana/blob/5.10.5.Final/rts/lra/lra-client/src/main/java/io/narayana/lra/client/NarayanaLRAClient.java#L758).
      The NarayanaLRAClient#endLRA tries to cancel the LRA. But as the coordinator timeouted the LRA then now depends if recovery already removed the LRA or not. If the LRA was not removed yet then 412, PRECONDITION FAILED is returned. If the recovery made it then 404, NOT FOUDN is returned.
      Now the endLRA considers the 404 as not a failure that is considered as 500, INTERNAL SERVER ERROR while the 412, PRECONDITION FAILED is considered as internal server error. That should not be that way as the LRA spec considers 412 as "correct" error (see https://github.com/eclipse/microprofile-lra/blob/1.0-M1/api/src/main/java/org/eclipse/microprofile/lra/annotation/ws/rs/LRA.java#L307).

      Such an anticipated return state should not be reported to client as 500 - internal server error.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                ochaloup Ondrej Chaloupka
                Reporter:
                ochaloup Ondrej Chaloupka
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: