Skip to content

Patch librdkafka NULL cgrp crash and confluent-kafka metadata over-read - #25483

Merged
steveny91 merged 8 commits into
masterfrom
sy/librdkafka-offsetfetch-null-cgrp
Oct 21, 2026
Merged

steveny91 merged 8 commits into
masterfrom
sy/librdkafka-offsetfetch-null-cgrp

Conversation

@steveny91

@steveny91 steveny91 commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Fixes two independent kafka_consumer crashes in the wheels the builders produce. Both change the same builder scripts, so they're combined here to rebuild and promote the wheels once.

  1. librdkafka NULL cgrp dereference. Applies librdkafka-fix-offsetfetch-null-cgrp.patch, a backport of upstream admin: fix ListConsumerGroupOffsets crash without a consumer group confluentinc/librdkafka#5611, on every builder platform and in the kafka_consumer CI install script. When a broker answers OffsetFetch with a coordinator error, librdkafka calls rd_kafka_cgrp_op on the AdminClient's NULL rk_cgrp and reads address 0x58 on rdk:main.
  2. confluent-kafka commit-metadata over-read. Builds confluent-kafka 2.13.2 from the PyPI sdist (pinned SHA-256) with confluent-kafka-fix-metadata-overread.patch, so TopicPartition_setup copies metadata_size bytes instead of calling strdup(). librdkafka returns commit metadata without a NUL terminator, so strdup reads past the buffer on rdk:bg, and under jemalloc the read can reach an unmapped page. This is Patch confluent-kafka to stop reading commit metadata past its end #25702 by @alexeypilyugin, included with his commit.

The dependency-resolution bot regenerates .deps/ after the push, and the wheels need ddev dep promote before merge.

Motivation

Node Agents running kafka_consumer exit with code 139 and no Go trace (DataDog/datadog-agent#44442). Core dumps from internal cluster show both signatures: strlen ← strdup ← c_part_to_py on rdk:bg, and a read of 0x58 inside librdkafka on rdk:main.

Each fix was verified on its own:

  • A mock-broker harness that answers OffsetFetch with NOT_COORDINATOR crashes stock 7.85.0-rc.6 and rc.7 Agent images and passes with the librdkafka patch.
  • Reading back unterminated 256-byte commit metadata under jemalloc over-reads on every run with stock confluent-kafka and returns exactly 256 bytes with the patch.
  • On internal cluster, a 7.85.0-rc.6 build with only the confluent-kafka fix ran about 16 hours with no over-read crash. Its two remaining crashes had the NULL cgrp signature (librdkafka+0xb1a81, preceded by NOT_COORDINATOR).

No new tests: these are builder patches, and the kafka_consumer CI installs confluent-kafka from PyPI, so it doesn't exercise the patched reader. The check-side mitigation, recreating the AdminClient after coordinator errors, already merged in #25485. Once @alexeypilyugin agrees, #25702 can be closed in favour of this PR.

Checklist before requesting review

  • I self-reviewed the full diff, and this description matches the final change
  • Tests cover the change, or this description explains why none are needed
  • Automated review comments, including Codex review, were addressed or answered
  • I, the human author, understand this change, can explain it to reviewers, and believe it meets the repository standards

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Wheels promoted to stable storage for commit dfaeca2344ba68444142df30c403330449b0a34b by @steveny91 in this workflow run.

dependency-wheel-promotion is green for that commit. Pushing again sends the check back to pending, and the new head has to be promoted before merging.

Full process: Dependency Updates.

@datadog-datadog-prod-us1-2

This comment has been minimized.

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

evalya-impact-summary

evalya impact analysis
Impact analysis: RUN-ALL — every test task will run
Trigger:         empty diff (default branch, scheduled run, or shallow-clone fallback)
Test tasks:      0 (all selected)
Publish tasks:   4 (always emitted)
Diff:            empty (no diff information)

Learn more about CI impact filtering

@steveny91 steveny91 changed the title patch librdkafka patch librdkafka ListConsumerGroupOffsets crash without a consumer group Oct 1, 2026
@dd-octo-sts

dd-octo-sts Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Disk usage change

Commit dfaeca2 compared against 0b85293.

Uncompressed

linux-aarch64 linux-x86_64 macos-aarch64 macos-x86_64 windows-x86_64
0 B 0 B 🔺 +32 B 🔺 +48 B 🔺 +1.5 KiB
Details
Name Version Type linux-aarch64 linux-x86_64 macos-aarch64 macos-x86_64 windows-x86_64
confluent-kafka 2.13.2 Dependency 0 B 0 B 🔺 +32 B 🔺 +48 B 🔺 +1.5 KiB

Compressed

linux-aarch64 linux-x86_64 macos-aarch64 macos-x86_64 windows-x86_64
🟢 -64 B 🟢 -153 B 🔺 +121 B 🟢 -2 B 🔺 +679 B
Details
Name Version Type linux-aarch64 linux-x86_64 macos-aarch64 macos-x86_64 windows-x86_64
confluent-kafka 2.13.2 Dependency 🔺 +15 B 🟢 -69 B 🔺 +148 B 🔺 +10 B 🔺 +678 B
cryptography 50.0.1 Dependency 🟢 -96 B 🟢 -78 B 0 B 🟢 -3 B 0 B
ddtrace 4.13.2 Dependency 0 B 0 B 🟢 -27 B 🟢 -9 B 0 B
gssapi 1.12.0 Dependency 🔺 +5 B 🔺 +14 B 0 B 0 B 0 B
aerospike 7.1.1 Dependency 0 B 🟢 -18 B 0 B 0 B 0 B
krb5 0.10.0 Dependency 🔺 +12 B 🔺 +1 B 0 B 0 B 0 B
pymqi 1.12.13 Dependency 0 B 🟢 -2 B 0 B 0 B 🟢 -1 B
psycopg-c 3.3.4 Dependency 0 B 0 B 0 B 0 B 🔺 +2 B
pyodbc 5.3.0 Dependency 0 B 🟢 -1 B 0 B 0 B 0 B

@chouetz chouetz added the internal Identify a non-fork PR label Oct 2, 2026
…tfetch-null-cgrp

Resolve the .deps/ conflicts by taking master's version. Those files are
generated by the resolve-build-deps workflow, which re-resolves them for
the merged builder inputs after the next push.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@steveny91
steveny91 marked this pull request as ready for review October 19, 2026 18:30
@steveny91
steveny91 requested review from a team as code owners October 19, 2026 18:30
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T18:33:17.148826Z 4c08b13 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The guard prevents the OffsetFetch error handler from dereferencing a missing consumer group while retaining coordinator refresh for consumer clients. Native builds and crash reproduction remain unverified.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 4c08b13

@steveny91 steveny91 added the qa/skip-qa Automatically skip this PR for the next QA label Oct 20, 2026
dd-agent-integrations-bot[bot] and others added 3 commits October 20, 2026 21:03
…tfetch-null-cgrp

# Conflicts:
#	.deps/builder_inputs.toml
#	.deps/image_digests.json
#	.deps/resolved/linux-aarch64_3.13.txt
#	.deps/resolved/linux-x86_64_3.13.txt
#	.deps/resolved/macos-aarch64_3.13.txt
#	.deps/resolved/macos-x86_64_3.13.txt
#	.deps/resolved/windows-x86_64_3.13.txt
Co-authored-by: Cursor <cursoragent@cursor.com>
@steveny91 steveny91 changed the title patch librdkafka ListConsumerGroupOffsets crash without a consumer group patch librdkafka ListConsumerGroupOffsets crash without a consumer group and work with jemalloc Oct 21, 2026
@steveny91 steveny91 changed the title patch librdkafka ListConsumerGroupOffsets crash without a consumer group and work with jemalloc Patch librdkafka NULL cgrp crash and confluent-kafka metadata over-read Oct 21, 2026
@dd-octo-sts

dd-octo-sts Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Validation Report

All 22 validations passed.

Show details
Validation Description Status
agent-reqs Verify check versions match the Agent requirements file ✅
ci Validate CI configuration and code coverage settings ✅
codeowners Validate every integration has a CODEOWNERS entry ✅
config Validate default configuration files against spec.yaml ✅
dep Verify dependency pins are consistent and Agent-compatible ✅
http Validate integrations use the HTTP wrapper correctly ✅
imports Validate check imports do not use deprecated modules ✅
integration-style Validate check code style conventions ✅
jmx-metrics Validate JMX metrics definition files and config ✅
labeler Validate PR labeler config matches integration directories ✅
legacy-signature Validate no integration uses the legacy Agent check signature ✅
license-headers Validate Python files have proper license headers ✅
licenses Validate third-party license attribution list ✅
metadata Validate metadata.csv metric definitions ✅
models Validate configuration data models match spec.yaml ✅
openmetrics Validate OpenMetrics integrations disable the metric limit ✅
package Validate Python package metadata and naming ✅
pr-description Validate the pull request checklist and visible description length ✅
qa-label Validate the pull request declares whether it needs QA for the next Agent release ✅
readmes Validate README files have required sections ✅
saved-views Validate saved view JSON file structure and fields ✅
version Validate version consistency between package and changelog ✅

View full run

@steveny91
steveny91 enabled auto-merge October 21, 2026 20:36
@steveny91
steveny91 added this pull request to the merge queue Oct 21, 2026
Merged via the queue into master with commit 940910b Oct 21, 2026
42 checks passed
@steveny91
steveny91 deleted the sy/librdkafka-offsetfetch-null-cgrp branch October 21, 2026 20:38
@dd-octo-sts dd-octo-sts Bot added this to the 7.86.0 milestone Oct 21, 2026
@temporal-github-worker-1

Copy link
Copy Markdown

Backport evaluation: View Slack thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/7.85.x internal Identify a non-fork PR qa/skip-qa Automatically skip this PR for the next QA team/agent-build team/agent-integrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants