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

Claus Ibsen commented on CAMEL-27518:
-------------------------------------

A friendly reminder: fixing bugs is a priority, and the Camel 4.24.0 release is 
coming up. If you cannot work on this ticket before then, please unassign it so 
someone else can pick it up.

_Claude Code on behalf of Claus Ibsen (davsclaus)_

> camel-netty - with a TimeoutCorrelationManagerSupport, a request whose 
> correlation id is used by another request that waits for its reply leaves 
> that request waiting forever
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27518
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27518
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-netty
>            Reporter: shashank
>            Assignee: shashank
>            Priority: Minor
>
> h3. What happens
> {{TimeoutCorrelationManagerSupport.putState}} puts the state of a request in 
> its timeout map under the correlation id of the request ({{map.put(cid, 
> state, timeout)}}). When another request with the same correlation id still 
> waits for its reply, its state is replaced and is in no map any more: neither 
> its reply nor the timeout of the manager completes it, so its exchange waits 
> forever (a synchronous caller blocks, the exchange stays in flight). If the 
> server answers the first request, that reply is set on the second exchange.
> The documentation of the {{correlationManager}} option only asks for a 
> correlation id in the request and the reply; it does not say what happens 
> when two requests that wait at the same time carry the same id. The manager 
> is documented to provide timeout support, so a request that is never 
> completed is a bug, even if a duplicate id is a mistake of the application.
> h3. How to reproduce
> {{producerPoolEnabled=false}} and a manager whose correlation id is the first 
> 3 characters of the body. Send {{abc-first}} and then {{abc-second}} to a 
> server that never replies, timeout 500 ms: the second fails with 
> {{ExchangeTimedOutException}} after 500 ms, the first is still not completed 
> after 5 s.
> Found with a TLA+ model ("every request that was put is eventually completed" 
> fails when two requests share a correlation id), and reproduced against the 
> real producer.
> h3. Fix
> {{putState}} refuses a correlation id that is held by a request that still 
> waits for its reply: the new request fails with an {{IllegalStateException}} 
> and is not sent, and the waiting request is left as it is. A state that is 
> already completed (its write failed; it stays in the map until it expires) is 
> replaced, as before. The check and the put are done under the lock of the 
> timeout map. With {{sync=false}} no reply is waited for, and the producer no 
> longer puts its requests in a {{TimeoutCorrelationManagerSupport}} (they only 
> stayed there until their timeout); otherwise two such requests with the same 
> id would be refused while the write of the first is not complete. Documented 
> on the component page and in the 4.24 upgrade guide.
> _Filed with Claude Code on behalf of allthingssecurity._



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to