Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
Needs James Gosling
Description
There seems to be a Otel context leak when using a CXF producer in async mode. This causes different requests to have the same traceId. As a workaround, setting synchronous=true on the CXF producer resolves the issue. Here's a reproducer:
@Override protected RoutesBuilder createRouteBuilder() { return new RouteBuilder() { @Override public void configure() { from("direct:start").routeId("myRoute") .to("direct:send") .end(); from("direct:send") .log("message") .to("cxfrs:http://localhost:" + port1 + "/rest/helloservice/sayHello?synchronous=false"); // setting to 'true' resolves the issue restConfiguration() .port(port1); rest("/rest/helloservice") .post("/sayHello").routeId("rest-GET-say-hi") .to("direct:sayHi"); from("direct:sayHi") .routeId("mock-GET-say-hi") .log("example") .to("mock:end"); }};
I've added the complete unit here: https://github.com/apache/camel/blob/7d83a62b8e442dc9ac6fd79b153192add940301e/components/camel-opentelemetry/src/test/java/org/apache/camel/opentelemetry/AsyncCxfTest.java
Attachments
Issue Links
- relates to
-
CXF-9063 OpenTelemetry context leak with CXF async client
- Resolved
-
CAMEL-21309 camel-cxf - When Exchange is using otel then run synchronous to avoid leaking spans
- Resolved