GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||
GeezerVison is showing github.com — gh-120321: Lock gen_send by Fidget-Spinner · Pull Request #120327 · python/cpython Conversation
|
|
What's the root cause of #120321? This feels like slapping a lock on something and hoping it works. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The crash's root cause is here https://github.com/python/cpython/pull/120327/files#diff-2a0c449b68605ebd0872fd232e60ce7e838a77782a6d2e364764f99514fb508aR219 Those 3 lines can race and cause I locked the whole thing because TSAN is warning not just those few lines. It warns that the _PyFrame_StackPush and all the other stack accessor functions in there are racing as well. Though I don't think that results in a crash. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
What about all the other places that I suspect that this doesn't crash only because specialization is turned off for free-threading: def gen(): while True: yield def my_next(it): for val in it: return value raise StopIteration it = gen() with concurrent.futures.ThreadPoolExecutor() as executor: while True: _ = executor.submit(lambda: my_next(it)) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Yeah the entire gen_send has multiple races in multiple places. Likewise for the specializing interpreter. So the entire thing needs to be locked (what the GIL does at the moment). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Pushing and popping generator frames needs to be locked. The best way to do that would be to move popping and pushing into its own helper function. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I agree that pushing and popping frames need fixing, but |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
OOI, what are the other crashes? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
A selection of them after I've locked just the frame pushing |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I wonder if we really only need the locks up to the transition to I think other than the asserts that only leaves |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
What's the status of this PR? It now has multiple merge conflicts. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.