[ 
https://issues.apache.org/jira/browse/CAMEL-25621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18126708#comment-18126708
 ] 

Guillaume Nodet commented on CAMEL-25621:
-----------------------------------------

This issue is being investigated by a coding agent (on behalf of gnodet).

*Root cause confirmed:* In MinaHelper.writeBody(), when 
WriteFuture.awaitUninterruptibly(writeTimeout) returns true (write completed 
within timeout), the code does not check whether the write actually succeeded 
via future.isWritten() or failed via future.getException(). It only throws when 
the wait times out. This means a write that completes-but-fails (e.g., codec 
encoding error, closed channel) is silently ignored.

With sync=true, the failure is eventually surfaced through the 
ResponseHandler.exceptionCaught() callback. With sync=false, there is no 
response handler, so the exchange completes with no error set.

_Note: This comment was generated by an AI coding agent and requires manual 
verification._

> camel-mina - A write that fails is not reported on the exchange when sync is 
> false
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-25621
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25621
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-mina
>            Reporter: Andrea Cosentino
>            Assignee: Guillaume Nodet
>            Priority: Major
>
> {{MinaHelper.writeBody}} waits for the {{WriteFuture}} with 
> {{awaitUninterruptibly(writeTimeout)}} and throws only when that wait times 
> out. When the write completes within the timeout but fails 
> ({{WriteFuture.isWritten()}} is false and {{getException()}} holds the 
> cause), the method returns normally. With {{sync=false}} the producer then 
> completes the exchange as if the message had been sent, although nothing was 
> written. With {{sync=true}} the failure is reported, through the response 
> handler.
> For example, a producer with {{sync=false}} whose codec throws while encoding 
> the message completes the exchange without an exception, and the server 
> receives nothing.
> Proposed change:
> * In {{MinaHelper.writeBody}}, after the wait, throw a 
> {{CamelExchangeException}} with the future's exception when the write did not 
> succeed.
> * Test: a producer with {{sync=false}} whose write fails gets the failure on 
> the exchange.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to