Skip to content
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

app._fatal_error never completes and ooms #3069

Closed
alefminus opened this issue Aug 8, 2023 · 5 comments
Closed

app._fatal_error never completes and ooms #3069

alefminus opened this issue Aug 8, 2023 · 5 comments

Comments

@alefminus
Copy link

alefminus commented Aug 8, 2023

Have you checked closed issues? https://github.com/Textualize/textual/issues?q=is%3Aissue+is%3Aclosed

  • yes, looked for _fatal_error, excepthook, did not find anything

Please give a brief but clear explanation of the issue. If you can, include a complete working example that demonstrates the bug. Check it can run without modifications.

Using aarch64, textual 0.32, python 3.9 on raspbian, on a raspberery pi 4.

I cannot share a reproducer yet (happens in a closed project source).

I could not provide a reproducer yet, but the problem is an exception triggered by a timer callback which goes into _fatal_error (I can see via py-spy, stack trace below), and does not complete, the process is eventually terminated by the oom-killer (I'm running on linux aarch64 raspbian on a raspberry pi 4 with 2 GB of ram, app normally takes ~60 MB).

I will try to produce a reproducer, I acknowledge this issue may be closed without one, I hoped to provide some "this happens" hook for future lookers.

I propose there should be a way to avoid this expensive / potentially buggy flow for a simpler "traceback.print_exc" or even "just exit" policy, perhaps by an environment variable or some configurable parameter via the textual module at runtime.

Here is the stack trace

Process 4334: /home/greenvibe/.cache/pypoetry/virtualenvs/devicecomm-o89zaWGP-py3.9/bin/python3 -m devicecomm.manual_mux
Python v3.9.2 (/usr/bin/python3.9)

Thread 0xB6FBB980 (active+gil): "MainThread"
    divide (rich/text.py:1114)
    split (rich/text.py:1089)
    wrap (rich/text.py:1222)
    __rich_console__ (rich/text.py:690)
    render (rich/console.py:1331)
    render (rich/console.py:1335)
    split_and_crop_lines (rich/segment.py:292)
    render_lines (rich/console.py:1371)
    __rich_console__ (rich/padding.py:97)
    render (rich/console.py:1331)
    split_and_crop_lines (rich/segment.py:292)
    render_lines (rich/console.py:1371)
    _render (rich/table.py:824)
    __rich_console__ (rich/table.py:511)
    render (rich/console.py:1331)
    split_and_crop_lines (rich/segment.py:292)
    render_lines (rich/console.py:1371)
    __rich_console__ (rich/padding.py:97)
    render (rich/console.py:1331)
    split_and_crop_lines (rich/segment.py:292)
    render_lines (rich/console.py:1371)
    __rich_console__ (rich/panel.py:220)
    render (rich/console.py:1331)
    split_and_crop_lines (rich/segment.py:292)
    render_lines (rich/console.py:1371)
    __rich_console__ (rich/padding.py:97)
    render (rich/console.py:1331)
    split_and_crop_lines (rich/segment.py:292)
    render_lines (rich/console.py:1371)
    _render (rich/table.py:824)
    __rich_console__ (rich/table.py:511)
    render (rich/console.py:1331)
    render (rich/console.py:1335)
    render (rich/console.py:1335)
    split_and_crop_lines (rich/segment.py:292)
    render_lines (rich/console.py:1371)
    __rich_console__ (rich/padding.py:97)
    render (rich/console.py:1331)
    split_and_crop_lines (rich/segment.py:292)
    render_lines (rich/console.py:1371)
    __rich_console__ (rich/panel.py:220)
    render (rich/console.py:1331)
    render (rich/console.py:1335)
    render (rich/console.py:1335)
    __init__ (rich/segment.py:668)
    _fatal_error (textual/app.py:1937)
    _handle_exception (textual/app.py:1928)
    _tick (textual/timer.py:157)
    _run (textual/timer.py:142)
    _run_timer (textual/timer.py:113)
    _run (asyncio/events.py:80)
    _run_once (asyncio/base_events.py:1890)
    run_forever (asyncio/base_events.py:596)
    run_until_complete (asyncio/base_events.py:629)
    run (textual/app.py:1317)
    main (devicecomm/manual_mux.py:647)
    <module> (devicecomm/manual_mux.py:654)
    _run_code (runpy.py:87)
    _run_module_as_main (runpy.py:197)
Thread 0xB2D06440 (idle): "Thread-1"
    wait (threading.py:312)
    get (queue.py:171)
    run (textual/drivers/_writer_thread.py:57)
    _bootstrap_inner (threading.py:954)
    _bootstrap (threading.py:912)
Thread 0xB23FF440 (idle): "Thread-2"
    select (selectors.py:469)
    run_input_thread (textual/drivers/linux_driver.py:260)
    run (threading.py:892)
    _bootstrap_inner (threading.py:954)
    _bootstrap (threading.py:912)
Thread 0xB19BF440 (active): "asyncio_0"
    _worker (concurrent/futures/thread.py:75)
    run (threading.py:892)
    _bootstrap_inner (threading.py:954)
    _bootstrap (threading.py:912)
Thread 0xB0F7F440 (active): "waitpid-0"
    _do_waitpid (asyncio/unix_events.py:1396)
    run (threading.py:892)
    _bootstrap_inner (threading.py:954)
    _bootstrap (threading.py:912)

It will be helpful if you run the following command and paste the results:

textual diagnose
<!-- This is valid Markdown, do not quote! -->
# Textual Diagnostics

## Versions

| Name    | Value  |
|---------|--------|
| Textual | 0.32.0 |
| Rich    | 13.5.2 |

## Python

| Name           | Value                                                                            |
|----------------|----------------------------------------------------------------------------------|
| Version        | 3.9.2                                                                            |
| Implementation | CPython                                                                          |
| Compiler       | GCC 10.2.1 20210110                                                              |
| Executable     | /home/greenvibe/.cache/pypoetry/virtualenvs/devicecomm-o89zaWGP-py3.9/bin/python |

## Operating System

| Name    | Value                                  |
|---------|----------------------------------------|
| System  | Linux                                  |
| Release | 6.1.21-v7l+                            |
| Version | #1642 SMP Mon Apr  3 17:22:30 BST 2023 |

## Terminal

| Name                 | Value     |
|----------------------|-----------|
| Terminal Application | *Unknown* |
| TERM                 | screen    |
| COLORTERM            | *Not set* |
| FORCE_COLOR          | *Not set* |
| NO_COLOR             | *Not set* |

## Rich Console options

| Name           | Value                |
|----------------|----------------------|
| size           | width=145, height=32 |
| legacy_windows | False                |
| min_width      | 1                    |
| max_width      | 145                  |
| is_terminal    | False                |
| encoding       | utf-8                |
| max_height     | 32                   |
| justify        | None                 |
| overflow       | None                 |
| no_wrap        | False                |
| highlight      | None                 |
| markup         | None                 |
| height         | None                 |


(note - I ran it in a different window then the one producing the exception, under tmux, so the actual height is more like 60, width is correct approximately)

Feel free to add screenshots and / or videos. These can be very helpful!

@github-actions
Copy link

github-actions bot commented Aug 8, 2023

We found the following entries in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

@alefminus
Copy link
Author

(just an additional note: for now my workaround is to override App._fatal_error in my inheriting app)

@willmcgugan
Copy link
Collaborator

Are you updating the UI from a thread (other than the main thread) ?

@willmcgugan
Copy link
Collaborator

Assuming stale. Will need more information to reopen.

Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

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

No branches or pull requests

2 participants