Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the entry with old id from the cache #4864

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

marcin-krystianc
Copy link

@marcin-krystianc marcin-krystianc commented Oct 8, 2024

Fixes #4778

This PR addresses a subtle issue in handling topic IDs during metadata cache insertion. Separating this condition ensures that old entries with non-zero topic IDs are always properly removed from the metadata cache.
Removing the entry from the rkmc_avl tree but not removing the old entry with non-zero topic IDs from the rkmc_avl_by_id tree led to an inconsistent cache state. Eventually, it led to memory corruption ("use after free" errors).

Testing

My test application re-creates (deletes and creates) three thousand topics. Then it immediately starts producer and consumer threads. Before the fix, the app crashed most of the time, after the fix crashes do not happen anymore.

@marcin-krystianc marcin-krystianc requested a review from a team as a code owner October 8, 2024 10:03
@confluent-cla-assistant
Copy link

confluent-cla-assistant bot commented Oct 8, 2024

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

Copy link

cla-assistant bot commented Oct 8, 2024

CLA assistant check
All committers have signed the CLA.

@marcin-krystianc marcin-krystianc changed the title remove the old id from the cache Remove the entry with old id from the cache Oct 8, 2024
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.

Crash (null-pointer access) in rd_kafka_metadata_cache_entry_by_id_cmp() during rd_avl_insert()
1 participant