Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Trace ID leakage in reactive Kafka consumer concatMap operations

Open
#9,775 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java, kafka

Research direction

Start with the linked reactive-kafka-consumer reproduction and run it with dd-java-agent versions 1.43.0 and 1.53.0. Compare trace IDs inside sequential concatMap processing with the outer chain and with flatMap. Done means each consumed message keeps its own Kafka-header trace ID throughout concatMap processing, without manual context management.

Written by the indexing model from the issue text.

Description

type: bug report
Tracer Version(s)

1.43.0, 1.53.0

Java Version(s)

17.0.15

JVM Vendor

Oracle JDK

Bug Report

When using dd-java-agent's automatic instrumentation with reactor-kafka, trace IDs from the first consumed Kafka message incorrectly leak into subsequent messages within concatMap operators. No manual span creation or context management is being used - this occurs purely with automatic instrumentation.

Actual Behavior

  1. First message: Trace ID is correctly set (e.g., trace_id=123)
  2. Second message: The outer reactive chain has a new trace ID (e.g., trace_id=456) - this is correct
    Operations inside concatMap still show the first message's trace ID (trace_id=123) - here expected trace_id=456

Issue does not occur with flatMap - only with concatMap (sequential processing)

Is manual context propagation required for concatMap scenarios, or is this a bug in automatic instrumentation?

Expected Behavior
  1. First message: Trace ID is correctly extracted from Kafka headers (e.g., trace_id=123) and maintained throughout the processing chain
  2. Second and subsequent messages: Each message's trace ID from its Kafka headers is properly extracted and maintained throughout the entire chain processing, independent of previous messages
Reproduction Code

https://github.com/faent/reactive-kafka-consumer/tree/main

Dominant language
Java
Stars
737
Forks
361
Avg merge
3d 20h
Merged PRs (30d)
173

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DataDog/dd-trace-java

All issues in DataDog/dd-trace-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.