[
https://issues.apache.org/jira/browse/CAMEL-17009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17434192#comment-17434192
]
Claus Ibsen edited comment on CAMEL-17009 at 10/26/21, 9:37 AM:
----------------------------------------------------------------
Okay so the MDC is getting more complicated in a reactive world. The code to
setup and cleanup MDC from current exchange in the routing engine gets trickier.
The sync can be fixed more easily as the UoW done should clean the MDC state,
which wasn't happening. *DONE*
Find a way for async which is more tricky
was (Author: davsclaus):
Okay so the MDC is getting more complicated in a reactive world. The code to
setup and cleanup MDC from current exchange in the routing engine gets trickier.
The sync can be fixed more easily as the UoW done should clean the MDC state,
which wasn't happening.
> camel-core - Camel does not clear MDC correctly
> -----------------------------------------------
>
> Key: CAMEL-17009
> URL: https://issues.apache.org/jira/browse/CAMEL-17009
> Project: Camel
> Issue Type: Bug
> Components: came-core
> Affects Versions: 3.11.0
> Reporter: Krzysztof Mackowiak
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 3.13.0
>
> Attachments: Clearing_MDC_in_Camel_.patch
>
>
> Unfortunately it looks that when MDC logging is enabled Camel does not clear
> MDC correctly.
> After a Camel message is processed by a thread MDC fields like
> camel.breadcrumbId are not cleared. It causes a mess in application logs. For
> example after Jetty thread processes a Camel message then other HTTP requests
> may be included in logs filtered by specific camel.breadcrumbId,
> camel.exchangeId etc.
> I've prepared a patch with a test that reproduces this problem (for branch
> main - Camel version 3.12.0-SNAPSHOT).
> This test is working (after small changes to be able to compile test with
> specific version) in Camel 2.25.3. Two tests out of three are passing in
> Camel versions between 3.0.0 and 3.8.0
> (shouldPropagateAndClearMdcInSyncRoute() and
> shouldPropagateAndClearMdcInAsyncRoute()). Starting from Camel 3.9.0 all
> three tests are failing.
> It seems that tests shouldPropagateAndClearMdcInSyncRoute() and
> shouldPropagateAndClearMdcInAsyncRoute() started failing
> because of a change in class UnitOfWorkHelper in commit 22c7af56
> (CAMEL-16222: camel-core - ExchangeFactory SPI to allow to use exchange
> pooling).
--
This message was sent by Atlassian Jira
(v8.3.4#803005)