-
Notifications
You must be signed in to change notification settings - Fork 815
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
Deadlock when closing app, associated with Footer.recompose and focus events #4677
Comments
Have you managed to reproduce this outside of pytest? |
Well, if you change the reproduction module to say:
then the issue technically happens outside of pytest, but it still uses Apart from this, I have been unable to reproduce this issue by running the application normally. |
There is a deadlock issue on `App._dom_lock`, where `_close_all` holds the lock and waits for the task associated with a message pump, but that task may be executing a "called-next" `_prune_nodes` call driven by an `AwaitRemove` which was triggered, for example, by the `Footer.recompose` call from handling the `bindings_updated` signal. This deadlock leads to a `TimeoutError` on app close. We fix this by omitting the call to `_prune_nodes` in the `AwaitRemove` task if the whole application is already closing; it does not make sense to remove individual nodes in this case anyway. Fixes Textualize#4677
Fixed in main. |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
A deadlock similar to the one described in #4643 occurs in a simple test case where the application is closed very soon after it gets initialized. The supposed fix for #4643 does not work for this case, and the deadlock is still reproducible with
textual
version 0.70.0.The issue seems to again be a bad interaction between the
Footer.recompose
call run as the response to thebindings_updated
signal and the procedure of closing the entire application. TheFooter.recompose
enqueues anAwaitRemove
callback while the_dom_lock
is already held by_close_all
, and closing theFooter
requires completing theAwaitRemove
future, leading to a deadlock. The issue seems to be triggered byset_focus
calls which we do from a background task.Minimal Reproduction Environment
Run
pytest editshare_system_upgrade/textual_ui/repro_app.py
to see theTimeoutError
:Output from `textual diagnose`
``` # Textual DiagnosticsVersions
Python
Operating System
Terminal
Rich Console options
The text was updated successfully, but these errors were encountered: