[NOGIL] Make Message class methods thread safe - #2350
Open
Ojasva Jain (ojasvajain) wants to merge 1 commit into
Open
[NOGIL] Make Message class methods thread safe#2350Ojasva Jain (ojasvajain) wants to merge 1 commit into
Ojasva Jain (ojasvajain) wants to merge 1 commit into
Conversation
Ojasva Jain (ojasvajain)
requested review from
a team and
Matthew Seal (MSeal)
as code owners
September 7, 2026 09:35
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
airlock-confluentinc
Bot
force-pushed
the
dev_thread_free_support
branch
from
September 8, 2026 06:57
a916f2f to
24155f9
Compare
airlock-confluentinc
Bot
force-pushed
the
msg_class_thread_safe
branch
from
September 8, 2026 06:59
21bfa1f to
615744f
Compare
|
Kaushik Raina (k-raina)
left a comment
Member
There was a problem hiding this comment.
Thanks for PR! Provided couple of comments
There was a problem hiding this comment.
Why are we not checking lock for "==" , "len()" etc?
There was a problem hiding this comment.
Can we expand more on test coverage, considering its change to message class? One thing i can thing of is memory leak test by counting refcount before and after?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Message class exposes getters and setters to five fields. On free threaded Python builds, calling setters and getters concurrently can cause use-after-free conditions and incorrect reference counts.
This PR fixes this by acquiring a lock around code snippets where we want only one thread to run at a time (critical sections). The getters and setters have been refactored as part of this process. In Message_headers, an unrelated bug related to error not being handled is also fixed.
For the five fields that have getters and setters, we have introduced five lock fields within the Message struct.
Also contains a minor fix in Consumer_consume method.
Checklist
References
JIRA:
Test & Review
Open questions / Follow-ups