Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-7795

Regression: MDC may lose values after when Async Routing Engine is used

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.12.4, 2.13.2
    • Fix Version/s: 2.12.5, 2.13.3, 2.14.0
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      Unknown
    • Regression:
      Regression

      Description

      CAMEL-6377 introduced some optimisations in the MDC Logging mechanism which make it lose MDC values when the async routing engine is used.

      If we are using an async component such as CXF, the response or done() callback will be issued from a thread NOT managed by Camel. Therefore, we need the MDCCallback to reset ALL MDC values, not just the routeId (as was intended by the commits that caused the regression).

      The situation may be salvaged by the fact that underlying MDC implementations use an InheritableThreadLocal, so the first requests after system initialisation may see correct behaviour, because the MDC values from the requesting thread is propagated to the newly initialised threads in the underlying stack's ThreadPool, as the coreThreads are being initialised within the context of the original threads which act like parent threads.

      But after those first attempts, odd behaviour is seen and all responses from the async endpoint come back without an MDC.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                raulvk Raúl Kripalani
                Reporter:
                raulvk Raúl Kripalani
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: