Skip to content

Conversation

@fangnx
Copy link
Member

@fangnx fangnx commented Nov 14, 2025

What

Some Admin module unit tests (e.g. test_list_consumer_group_offsets_api) finishes but after that the callback function (_make_consumer_group_offsets_result), running in the librdkafka's background, triggers garbage collection. When librdkafka detects that rd_kafka_destroy is invoked from its own thread (https://github.com/confluentinc/librdkafka/blob/616fb6e8074e82e0302f1c7d2896d7e577f8eb9b/src/rdkafka.c#L1115), it sends the ABORT signal

Using context manager as a workaround as it seems to help with cleaning up AdminClient object. To fix the root cause, we have to do a deeper investigation in librdkafka

Checklist

  • Contains customer facing changes? Including API/behavior changes
  • Did you add sufficient unit test and/or integration test coverage for this PR?
    • If not, please explain why it is not required

References

JIRA: https://confluentinc.atlassian.net/browse/NONJAVACLI-4105

Test & Review

Open questions / Follow-ups

@confluent-cla-assistant
Copy link

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

@sonarqube-confluent
Copy link

@fangnx fangnx changed the title try Use ContextManager as workaround to mitigate GC issues in some Admin tests Nov 14, 2025
@fangnx fangnx marked this pull request as ready for review November 14, 2025 17:59
@fangnx fangnx requested review from a team and MSeal as code owners November 14, 2025 17:59
Copilot AI review requested due to automatic review settings November 14, 2025 17:59
@fangnx fangnx requested a review from a team as a code owner November 14, 2025 17:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces context manager usage for AdminClient instances in Admin API tests to address garbage collection issues. The changes wrap AdminClient instantiation in with statements, ensuring proper resource cleanup. Additionally, some long lines are reformatted for better readability.

  • Wraps AdminClient instances in context managers using with statements
  • Reformats long lines to improve code readability
  • Applies changes across multiple test functions for consumer groups and SCRAM credentials

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fangnx fangnx merged commit b3caca6 into master Nov 14, 2025
3 checks passed
@fangnx fangnx deleted the admin-segfault-context branch November 14, 2025 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants