ffang commented on PR #3741:
URL: https://github.com/apache/cxf/pull/3741#issuecomment-7110415205

   > Thanks for the update. It fixes the ack-before-reply ordering, the late 
SOAP-fault partial response and the `getException(Exchange)` override. Three 
minor points remain:
   > 
   > 1. **An async one-way call to a decoupled endpoint may never complete.** 
`receive()` treats every 202 with no body as a partial response when a 
decoupled destination is configured. For a one-way operation no other response 
will arrive, and `HTTPConduit` doesn't complete the callback for decoupled 
endpoints, so with `propagate202Response` the callback is never completed. 
Before this change the propagated 202 completed it with a `null` result. Could 
`isDecoupledAcknowledgement` also check `!exchange.isOneWay()`?
   > 2. **`getException(Exchange, Message)` can still pick up a late fault.** 
The check `response == exchange.getInMessage()` and the later read in 
`getException(exchange)` are separate, unlocked steps. During async processing 
the exchange isn't `FINISHED` yet, so a SOAP-fault partial response that 
arrives between them gets set as the in-fault message by 
`InFaultChainInitiatorObserver`. The reply's callback then gets that fault. 
It's a narrow window. One fix is to read `response.getContent(Exception.class)` 
directly unless `response == exchange.getInFaultMessage()`.
   > 3. **Late messages run the inbound chain while the exchange still points 
at the reply.** Once the exchange is `FINISHED`, `receive()` doesn't make a 
late message the in message, but that message still runs the whole chain. An 
interceptor that reads `exchange.getInMessage()` instead of its `handleMessage` 
argument would read or change the reply. It's worth checking the WS-Addressing, 
WS-RM and security interceptors, and documenting this if nothing needs to 
change.
   
   Thanks @coheigea. Points 1 and 2 are fixed in 0906d4dd17. Point 3 needed no 
code change.
   
   **1. Async one-way call to a decoupled endpoint.** Right, a one-way call 
gets no other response, so marking its 202 as partial left the callback 
waiting. `isDecoupledAcknowledgement` now returns false for 
`exchange.isOneWay()`, so the 202 completes the call as before. Test: 
`testAcknowledgementOfAsyncOneWayCall`.
   
   **2. Late fault between the check and the read.** Confirmed. Reading the 
response directly would skip the overridable `getException(Exchange)` again, so 
I kept it and closed the window instead. The exchange's in fault message only 
goes from unset to set, so if it is still unset after `getException(Exchange)` 
returns, that method can't have read a late fault. If it did get set meanwhile, 
the result is discarded and the response's own failure is used. Test: 
`testSoapFaultArrivingWhileAsyncFailureIsResolved` injects the fault inside 
that window.
   
   **3. Late messages and the exchange.** I went through the `getInMessage()` 
uses in WS-Addressing, WS-RM, SOAP, WS-Security and WS-Policy. None reads the 
reply on a client's inbound chain:
   - `DecoupledFaultHandler` and `MTOMPolicyInterceptor` only run on the server 
side;
   - `RMContextUtils` reads it only for outbound messages;
   - `SAAJPreInInterceptor` uses it only as an "already processed" check.
   
   So nothing needs to change IMO. As you suggested, I documented the behaviour 
in a comment on `ClientImpl.receive()`.
   
   The new tests fail on the previous head. The core endpoint, http, 
WS-Addressing and WS-RM decoupled tests pass.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to