8000 Fix racey hang while unwinding wrap_py_function by bpcreech · Pull Request #66 · bpcreech/PyMiniRacer · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix racey hang while unwinding wrap_py_function #66

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

Merged
merged 1 commit into from
May 25, 2024

Conversation

bpcreech
Copy link
Owner
@bpcreech bpcreech commented May 25, 2024

Before this change, wrap_py_function could tear down the JS callback function and stop processing callbacks, but then receive straggling callbacks that were still being transported from the V8 thread to the asyncio event loop thread. It would then the queue-accounting logic would wait on those last straggling callbacks and never finish them, since it had already torn down the processing task.

Now we may still create tasks for straggling callbacks, but then we'll consistently drop those tasks if we've already stopped processing pending items.

This also gets rid of the use of asyncio.Queue which I realized wasn't making anything easier. (I want it to be a golang channel, but it isn't!)

@bpcreech bpcreech force-pushed the feature/fix-shutdown-hang branch from c13a564 to 58d08fb Compare May 25, 2024 18:06
@bpcreech bpcreech merged commit 99591c9 into main May 25, 2024
1 check passed
@bpcreech bpcreech deleted the feature/fix-shutdown-hang branch May 27, 2024 21:25
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.

1 participant
0