Disable the thread state lock#211
Closed
vstinner wants to merge 3 commits intoeventlet:semaphore_timeoutfrom
vstinner:semaphore_timeout
Closed
Disable the thread state lock#211vstinner wants to merge 3 commits intoeventlet:semaphore_timeoutfrom vstinner:semaphore_timeout
vstinner wants to merge 3 commits intoeventlet:semaphore_timeoutfrom
vstinner:semaphore_timeout
Conversation
For the Python implementation of threading.RLock because the new C implementation of threading.RLock of Python 3.3 is not compatible with eventlet monkey patching. Fix the issue #185.
Contributor
Author
|
Oh, my commit was already pushed to pull request #187, it's not useful to open a duplicate pull request. I'm closing this one. |
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.
This change fixes the threading support on Python 3.4 when eventlet is used with monkey-patching.
Python 3.4 introduces threading.Thread._tstate_lock to fix a race condition, see:
I'm not really proud of this change: patching a Thread instance after its creation is not the most elegant fix.
I tried to create a Thread subclass in eventlet.green.threading, but I got a lot of new issues. If the subclass is declared in eventlet.green.threading, the parent Thread class uses functions of the original threading module, instead of using patched functions by eventlet. It's unclear to me how symbols are added and patched in modules. I noticed that the threading module of the standard library is imported multiple times. The implementation of monkey-patching is really complex :-/
Currently, the best solution is to patch Thread instance in the patched thread.start_new_thread() function. The problem is to retrieve the instance. My heuristic checks if the wrapped function is the bounded Thread.run() method, and I retrieve the instance from function.self.
I'm not yet sure that I really understood the problem. At least, "tox -e py34-selects" pass.