Comments (12)
I'm not sure the deadlock detection is hiding an error. Without the timeout, it would have frozen.
If a broken compose prevents a mount or prune, we might have to handle that case explicitly.
from textual.
It was definitely hiding an error (to be clear, I mean an error in my app, not Textual, inside a widget's compose
method. By "hiding", I mean there was no stack trace printed by Textual anywhere indicating why my app crashed, just the TimeoutError) - I wrapped the code that contained an exception in a try/except and printed out the exception.
When I didn't catch the error myself, it bubbled up to Textual and the app crashed with the deadlock issue after 5 seconds, and there was no sign of the original error.
from textual.
I will try to MRE this tomorrow.
from textual.
Have spent some time trying and failing to MRE this, but I'm pretty certain there's an issue.
My app had a logic bug which caused a plain old exception to be raised, but Textual never presented that exception to the user. The user was only presented with "possible deadlock" when the app crashed.
from textual.
I just hit this issue again - receiving a "possible deadlock" which is hiding another exception in my app, making debugging difficult.
I think it's unrelated to screens and is a more general issue - trying another MRE now.
from textual.
Override _handle_exception
in the App
:
E.g.:
def _handle_exception(self, error: Exception) -> None:
global exc
exc = error
super()._handle_exception(error)
It'll allow you to see the errors
from textual.
I've also noticed that I get this warning in the devtools each time I see the deadlock issue:
[14:45:01] WARNING _callback.py:73
Callback functools.partial(<function
Footer.on_mount.<locals>.bindings_changed at 0x1047f87c0>, MainScreen()) is
still pending after 3 seconds
from textual.
Seems to not be restricted to 0.71.0.
@arcivanov The issue here is exceptions are not making it into Textual's usual error handling flow, so this doesn't do anything in this case.
from textual.
I also encountered this error, and when the same operation was performed, this error can be 100% reproduced.
Traceback (most recent call last):
File "C:\Users\youyq\PycharmProjects\XHS-Downloader\main.py", line 75, in <module>
run(app())
File "C:\Program Files\Python312\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\asyncio\base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\youyq\PycharmProjects\XHS-Downloader\main.py", line 61, in app
await xhs.run_async()
File "C:\Users\youyq\PycharmProjects\XHS-Downloader\venv\Lib\site-packages\textual\app.py", line 1572, in run_async
await app._shutdown()
File "C:\Users\youyq\PycharmProjects\XHS-Downloader\venv\Lib\site-packages\textual\app.py", line 2804, in _shutdown
await self._close_all()
File "C:\Users\youyq\PycharmProjects\XHS-Downloader\venv\Lib\site-packages\textual\app.py", line 2784, in _close_all
await self._prune_node(stack_screen)
File "C:\Users\youyq\PycharmProjects\XHS-Downloader\venv\Lib\site-packages\textual\app.py", line 3445, in _prune_node
raise asyncio.TimeoutError(
TimeoutError: Timeout waiting for [ToastRack(id='textual-toastrack'), Tooltip(id='textual-tooltip'), Header(), Label(), Label(), Label(), Label(), Label(), Label(), Label(), Label(), Footer()] to close; possible deadlock (consider changing App.CLOSE_TIMEOUT)
from textual.
I downgraded it to 0.63.0 and found that abnormalities only occur when switching screens quickly. If I pause on the screen for a few seconds before switching to another screen, there will be no abnormalities.
from textual.
I'm going to close this for now - I think it's resolved by 0.72.0. If anyone here thinks otherwise let us know!
from textual.
Don't forget to star the repository!
Follow @textualizeio for Textual updates.
from textual.
Related Issues (20)
- Pasting "〽️" in TextArea Moves Cursor Too Far HOT 12
- Textual 0.71 introduces another deadlock in Memray's test suite HOT 3
- Disabled TabPane can still be Accessed/selected via the underline bar HOT 2
- Key events should not be sent to an inactive screen HOT 3
- Several command palette issues on 0.71.0 HOT 3
- Clicking on a Separator inside an OptionList throws the cursor to the first option (v0.71.0 only) HOT 2
- Trying to remove Footer results in "node has no screen" HOT 3
- Integer validator does not work as expected permitting floating point numbers HOT 1
- DataTable.add_row gives misleading error with too many arguments. HOT 2
- ScrollView initial scroll before mount
- TabPane selectable when disabled HOT 4
- Failing snapshot tests with `pytest tests/snapshot_tests/test_snapshots.py`? HOT 13
- `ListView.remove_items()` removes all items HOT 1
- DataTable: Switching focus is slow when table contains lots of data HOT 4
- Markdown widget - hyperlinks does not open browser on click HOT 5
- Dynamic Bindings HOT 2
- Tree.scroll_to_line() off-by-2 error in x coordinate? HOT 3
- documentation issues HOT 4
- Dynamic actions sharing the same keybinding HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from textual.