gnodet-bot commented on code in PR #29450:
URL: https://github.com/apache/camel/pull/29450#discussion_r4523189181


##########
components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfClientCallback.java:
##########
@@ -71,8 +71,13 @@ public void handleResponse(Map<String, Object> ctx, Object[] 
res) {
             // for one way messages callback is already called in
             // process method of org.apache.camel.component.cxf.CxfProducer
             if (!boi.getOperationInfo().isOneWay()) {
-                
endpoint.getCxfBinding().populateExchangeFromCxfResponse(camelExchange, 
cxfExchange, ctx);
-                camelAsyncCallback.done(false);
+                try {
+                    
endpoint.getCxfBinding().populateExchangeFromCxfResponse(camelExchange, 
cxfExchange, ctx);
+                } finally {
+                    // always signal the Camel callback, even if 
populateExchangeFromCxfResponse throws,
+                    // to prevent the calling thread from hanging in 
DefaultAsyncProcessorAwaitManager
+                    camelAsyncCallback.done(false);
+                }

Review Comment:
   ⚠️ **Silent success on response-binding failure (`handleResponse` path):** 
If `populateExchangeFromCxfResponse()` throws here, `done(false)` is called via 
`finally` (the hang is fixed ✅), but no exception is set on `camelExchange`. 
The calling thread receives a completed exchange with `getException() == null` 
— it looks like a successful call when the response binding actually failed.
   
   In `handleException`, this is not a problem because 
`camelExchange.setException(ex)` is called before this block. But in the 
success path (`handleResponse`), there is no prior `setException` call — an 
exception from `populateExchangeFromCxfResponse` would be silently lost.
   
   ```suggestion
                   try {
                       
endpoint.getCxfBinding().populateExchangeFromCxfResponse(camelExchange, 
cxfExchange, ctx);
                   } catch (Exception e) {
                       camelExchange.setException(e);
                   } finally {
                       // always signal the Camel callback, even if 
populateExchangeFromCxfResponse throws,
                       // to prevent the calling thread from hanging in 
DefaultAsyncProcessorAwaitManager
                       camelAsyncCallback.done(false);
                   }
   ```



-- 
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