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

Krzysztof Jamróz edited comment on CAMEL-16178 at 2/15/21, 7:38 PM:
--------------------------------------------------------------------

I started a pull request (https://github.com/apache/camel/pull/5093) but I 
found one more problem, because after my fix {{NettyReuseChannelTest}} hangs. 
This is because each {{NettyProducer}} (there are 2) has each own 
{{NettyCamelStateCorrelationManager}} each with separate map of 
{{NettyCamelState}}. And when netty is invoked second time, what is supposed to 
reuse channel, it really reuses it but registers callback in wrong correlation 
manager. {{NettyCamelState}} should be registered in correlation manager for 
producer that opened the channel but uses correlation manager of sending 
producer.


was (Author: krzysztofjamroz):
I started a pull request (https://github.com/apache/camel/pull/5093) but I 
found one more problem, because after my fix {{NettyReuseChannelTest}} hangs. 
This is because each {{NettyProducer}} (there are 2) has each own 
{{NettyCamelStateCorrelationManager}} each with separate map of 
{{NettyCamelState}}s. And when netty is invoked second time, what is supposed 
to reuse channel, it really reuses it but registers callback in wrong 
correlation manager. {{NettyCamelState}} should be registered in correlation 
manager for producer that opened the channel but uses correlation manager of 
sending producer.

> Enrich with REST+netty hangs when connection is closed without response
> -----------------------------------------------------------------------
>
>                 Key: CAMEL-16178
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16178
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 3.4.5, 3.7.2
>            Reporter: Krzysztof Jamróz
>            Priority: Major
>             Fix For: 3.7.3, 3.9.0
>
>         Attachments: EnrichWithoutRestResponseTest.java
>
>
> Enricher hangs when used with REST endpoint utilizing netty when there is no 
> response from the server but the server immediately closes the connection. In 
> such case read timeout is ignored as connection is already closed.
>  
> The reason of this behavior is that 
> {{org.apache.camel.component.netty.handlers.ClientChannelHandler.channelInactive}}
>  contains following conditions for callback invocation when there was no 
> response: 
> {code:java}
> configuration.isSync() && !doneUoW && !messageReceived && !exceptionHandled
> {code}
> where
> {code:java}
> doneUoW = exchange.getUnitOfWork() == null
> {code}
> It works as expected when initially there had been UoW in Exchange (this is 
> the case when using {{to}}). However, enricher by default (and by design) 
> clears UoW for exchange it creates and this breaks above check.
> Setting {{shareUnitOfWork}} for {{enrich}} works around the problem.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to