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

Wrong format of the Link header on joining LRA by participant should return error to the participant

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 5.8.2.Final
    • Component/s: LRA
    • Labels:
      None
    • Steps to Reproduce:
      Hide
      curl -i -X POST http://127.0.0.1:8080/lra-coordinator/start
      

      Trying to enlist with Link header which is not url:

      curl -i -X PUT -H "Link: I DO NOT EXIT" http://localhost:8080/lra-coordinator/0_ffff0a000007_-39bdc3dc_5a098390_d
      HTTP/1.1 400 Bad Request
      

      Swarm log:

      INFO  [io.narayana.lra] (default task-6) Cannot extract compensator from link'I DO NOT EXIT': java.lang.IllegalArgumentException: RESTEASY003960: Unable to parse Link header.  No end to parameter: I DO NOT EXIT
      ...
      ERROR [io.narayana.lra] (default task-6) LRA025024: Invalid LRA id format to create LRA record from LRA id 'http://localhost:8080/lra-coordinator/0_ffff0a000007_-39bdc3dc_5a098390_d', link URI 'I DO NOT EXIT'
      

      on the other hand if Link is a valid URL but format of the Link header does not comply what LRA expects

      curl -i -X PUT -H "Link: http://localhost" http://localhost:8080/lra-coordinator/0_ffff0a000007_-39bdc3dc_5a098390_d
      HTTP/1.1 200 OK
      

      and the swarm log

      2017-11-13 12:41:52,128 INFO  [io.narayana.lra] (default task-7) Cannot extract compensator from link'http://localhost': java.lang.IllegalArgumentException: RESTEASY003960: Unable to parse Link header.  No end to parameter: http://localhost
              at org.jboss.resteasy.plugins.delegates.LinkDelegate$Parser.parseAttribute(LinkDelegate.java:112)
              at org.jboss.resteasy.plugins.delegates.LinkDelegate$Parser.parse(LinkDelegate.java:63)
              at org.jboss.resteasy.plugins.delegates.LinkDelegate.fromString(LinkDelegate.java:160)
              at org.jboss.resteasy.plugins.delegates.LinkDelegate.fromString(LinkDelegate.java:23)
              at org.jboss.resteasy.specimpl.LinkImpl.valueOf(LinkImpl.java:31)
              at org.jboss.resteasy.specimpl.LinkBuilderImpl.link(LinkBuilderImpl.java:34)
              at javax.ws.rs.core.Link.valueOf(Link.java:173)
              at io.narayana.lra.coordinator.domain.model.LRARecord.extractCompensator(LRARecord.java:150)
              at io.narayana.lra.coordinator.domain.model.Transaction.findLRAParticipant(Transaction.java:498)
              at io.narayana.lra.coordinator.domain.model.Transaction.enlistParticipant(Transaction.java:436)
              at io.narayana.lra.coordinator.domain.service.LRAService.joinLRA(LRAService.java:268)
              at io.narayana.lra.coordinator.domain.service.LRAService$Proxy$_$$_WeldClientProxy.joinLRA(Unknown Source)
              at io.narayana.lra.coordinator.api.Coordinator.joinLRA(Coordinator.java:468)
              at io.narayana.lra.coordinator.api.Coordinator.joinLRAViaBody(Coordinator.java:406)
              at io.narayana.lra.coordinator.api.Coordinator$Proxy$_$$_WeldClientProxy.joinLRAViaBody(Unknown Source)
      
      Show
      curl -i -X POST http: //127.0.0.1:8080/lra-coordinator/start Trying to enlist with Link header which is not url: curl -i -X PUT -H "Link: I DO NOT EXIT" http: //localhost:8080/lra-coordinator/0_ffff0a000007_-39bdc3dc_5a098390_d HTTP/1.1 400 Bad Request Swarm log: INFO [io.narayana.lra] ( default task-6) Cannot extract compensator from link 'I DO NOT EXIT' : java.lang.IllegalArgumentException: RESTEASY003960: Unable to parse Link header. No end to parameter: I DO NOT EXIT ... ERROR [io.narayana.lra] ( default task-6) LRA025024: Invalid LRA id format to create LRA record from LRA id 'http: //localhost:8080/lra-coordinator/0_ffff0a000007_-39bdc3dc_5a098390_d' , link URI 'I DO NOT EXIT' on the other hand if Link is a valid URL but format of the Link header does not comply what LRA expects curl -i -X PUT -H "Link: http: //localhost" http://localhost:8080/lra-coordinator/0_ffff0a000007_-39bdc3dc_5a098390_d HTTP/1.1 200 OK and the swarm log 2017-11-13 12:41:52,128 INFO [io.narayana.lra] ( default task-7) Cannot extract compensator from link 'http: //localhost' : java.lang.IllegalArgumentException: RESTEASY003960: Unable to parse Link header. No end to parameter: http://localhost at org.jboss.resteasy.plugins.delegates.LinkDelegate$Parser.parseAttribute(LinkDelegate.java:112) at org.jboss.resteasy.plugins.delegates.LinkDelegate$Parser.parse(LinkDelegate.java:63) at org.jboss.resteasy.plugins.delegates.LinkDelegate.fromString(LinkDelegate.java:160) at org.jboss.resteasy.plugins.delegates.LinkDelegate.fromString(LinkDelegate.java:23) at org.jboss.resteasy.specimpl.LinkImpl.valueOf(LinkImpl.java:31) at org.jboss.resteasy.specimpl.LinkBuilderImpl.link(LinkBuilderImpl.java:34) at javax.ws.rs.core.Link.valueOf(Link.java:173) at io.narayana.lra.coordinator.domain.model.LRARecord.extractCompensator(LRARecord.java:150) at io.narayana.lra.coordinator.domain.model.Transaction.findLRAParticipant(Transaction.java:498) at io.narayana.lra.coordinator.domain.model.Transaction.enlistParticipant(Transaction.java:436) at io.narayana.lra.coordinator.domain.service.LRAService.joinLRA(LRAService.java:268) at io.narayana.lra.coordinator.domain.service.LRAService$Proxy$_$$_WeldClientProxy.joinLRA(Unknown Source) at io.narayana.lra.coordinator.api.Coordinator.joinLRA(Coordinator.java:468) at io.narayana.lra.coordinator.api.Coordinator.joinLRAViaBody(Coordinator.java:406) at io.narayana.lra.coordinator.api.Coordinator$Proxy$_$$_WeldClientProxy.joinLRAViaBody(Unknown Source)

      Description

      If there is a participant joining a started LRA which uses wrong format of Link header then NullPointer is logged to the swarm server log. But client gets status OK.

      Client should be informed that enlistment failed and there should not be nullpointer in the log.

      NullPointer

      INFO  [io.narayana.lra] (default task-4) Cannot extract compensator from link'http://localhost': java.lang.IllegalArgumentException: RESTEASY003960: Unable to parse Link header.  No end to parameter: http://localhost
              at org.jboss.resteasy.plugins.delegates.LinkDelegate$Parser.parseAttribute(LinkDelegate.java:112)
              at org.jboss.resteasy.plugins.delegates.LinkDelegate$Parser.parse(LinkDelegate.java:63)
              at org.jboss.resteasy.plugins.delegates.LinkDelegate.fromString(LinkDelegate.java:160)
              at org.jboss.resteasy.plugins.delegates.LinkDelegate.fromString(LinkDelegate.java:23)
              at org.jboss.resteasy.specimpl.LinkImpl.valueOf(LinkImpl.java:31)
              at org.jboss.resteasy.specimpl.LinkBuilderImpl.link(LinkBuilderImpl.java:34)
              at javax.ws.rs.core.Link.valueOf(Link.java:173)
              at io.narayana.lra.coordinator.domain.model.LRARecord.extractCompensator(LRARecord.java:150)
              at io.narayana.lra.coordinator.domain.model.Transaction.findLRAParticipant(Transaction.java:498)
              at io.narayana.lra.coordinator.domain.model.Transaction.enlistParticipant(Transaction.java:428)
              at io.narayana.lra.coordinator.domain.service.LRAService.joinLRA(LRAService.java:268)
              at io.narayana.lra.coordinator.domain.service.LRAService$Proxy$_$$_WeldClientProxy.joinLRA(Unknown Source)
              at io.narayana.lra.coordinator.api.Coordinator.joinLRA(Coordinator.java:468)
              at io.narayana.lra.coordinator.api.Coordinator.joinLRAViaBody(Coordinator.java:406)
              at io.narayana.lra.coordinator.api.Coordinator$Proxy$_$$_WeldClientProxy.joinLRAViaBody(Unknown Source)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
              at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
              at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
              at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
              at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:402)
              at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:209)
              at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
              at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
              at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
              at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
              at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
              at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
              at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
              at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
              at org.wildfly.swarm.generated.FaviconErrorHandler.handleRequest(FaviconErrorHandler.java:62)
              at io.undertow.server.handlers.PathHandler.handleRequest(PathHandler.java:94)
              at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
              at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
              at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
              at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
              at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
              at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
              at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
              at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
              at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
              at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
              at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
              at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
              at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
              at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
              at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
              at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
              at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
              at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
              at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
              at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
              at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
              at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
              at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
              at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
              at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
              at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
              at io.undertow.server.Connectors.executeRootHandler(Connectors.java:211)
              at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:809)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at java.lang.Thread.run(Thread.java:748)
      

      The ok return code:

      curl -i -X PUT -H "Link: http://localhost" http://localhost:8080/lra-coordinator/0_ffff0a000007_-39bdc3dc_5a098390_d
      HTTP/1.1 200 OK
      Connection: keep-alive
      Long-Running-Action-Recovery: http://localhost:8080/lra-recovery-coordinator/http%3A%2F%2Flocalhost%3A8080%2Flra-coordinator%2F0_ffff0a000007_-39bdc3dc_5a098390_d/0_ffff0a000007_-39bdc3dc_5a098390_11
      Location: http://localhost:8080/lra-recovery-coordinator/http%3A%2F%2Flocalhost%3A8080%2Flra-coordinator%2F0_ffff0a000007_-39bdc3dc_5a098390_d/0_ffff0a000007_-39bdc3dc_5a098390_11
      Content-Type: application/json
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                mmusgrov Michael Musgrove
                Reporter:
                ochaloup Ondrej Chaloupka
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: