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

Move some global variables in parser into thread local #264

Merged
merged 1 commit into from
May 7, 2024

Conversation

aisk
Copy link
Member

@aisk aisk commented May 7, 2024

Related to #232.

I'm not sure if this can totally resolve the original issue, because reproducing a multi-thread bug is hard. I'd like to ship the change because it wouldn't introduce any trouble, and wait to see if there will be more multi-thread issues with the parser. Otherwise, we should introduce a big lock for all these load methods.

@aisk
Copy link
Member Author

aisk commented May 7, 2024

The failed tests are caused by pytest-dev/pytest#12263, as that issue said it will be fixed on tornado or pytest repository, so I'll leave as it is for now.

@aisk aisk merged commit 49fe0ef into Thriftpy:master May 7, 2024
15 of 18 checks passed
@aisk aisk deleted the parser-thread-safe branch May 7, 2024 07:39
@truebit
Copy link
Contributor

truebit commented May 14, 2024

This change would invoke error AttributeError: '_thread._local' obiect has no attribute 'thrift_stack' when using it with example code:

>>> from thriftpy2.parser. parser import parse
>>> note_thrift = parse("path/ to/ note. thrift")

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.

None yet

3 participants