You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Krzysztof Mackowiak (Jira)" <ji...@apache.org> on 2021/09/27 19:50:00 UTC
[jira] [Created] (CAMEL-17009) Camel does not clear MDC correctly
Krzysztof Mackowiak created CAMEL-17009:
-------------------------------------------
Summary: 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, 3.x
Reporter: Krzysztof Mackowiak
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)