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

Mint Tea hangs when trying to render a TUI app #34

Closed
chshersh opened this issue Feb 10, 2024 · 2 comments
Closed

Mint Tea hangs when trying to render a TUI app #34

chshersh opened this issue Feb 10, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@chshersh
Copy link

chshersh commented Feb 10, 2024

I noticed that my Mint Tea app hangs on the start occasionally.

Sometimes the app is snappy but sometimes displays the initial screen and ignores all the future key events (or takes about 20 seconds to process a keyboard event).

When such a problem happens, I see that strace spams with errors:

clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=10000}, NULL) = 0
futex(0x55aab30882a8, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x55aab503d8b0, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource temporarily unavailable)
futex(0x55aab503d8b0, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x55aab503d8b0, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource temporarily unavailable)
futex(0x55aab503d8b0, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x55aab503d8b0, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource temporarily unavailable)
futex(0x55aab503d8b0, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x55aab503d8b0, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource temporarily unavailable)
futex(0x55aab503d8b0, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x55aab30882a8, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x55aab503d8b0, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource temporarily unavailable)
futex(0x55aab503d8b0, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x55aab503d8b0, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource temporarily unavailable)
futex(0x55aab503d8b0, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x55aab503d8b0, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource temporarily unavailable)
futex(0x55aab503d8b0, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x55aab503d8b0, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource temporarily unavailable)
futex(0x55aab503d8b0, FUTEX_WAKE_PRIVATE, 1) = 0

I forked minttea and added some logging, and I observed that Mint Tea hangs on receiving and processing Frame events here:

You can try to reproduce the problem using the following project:

It uses OCaml 5.1.1 and pinned from GitHub versions of all Mint Tea ecosystem dependencies.

Run the project by executing dune exec bin/main.exe and try pressing numbers 1,2,3 or arrows or hjkl or q to quit.

Expected behaviour: The TUI app is immediately responsive and rerenders instantly

Actual behaviour: The TUI app sometimes hangs and stops responding to input key events

The error is flaky and is not always reproducible

I'm on Windows 11 and running my project through WSL2 and Ubuntu.

@Lattay
Copy link
Contributor

Lattay commented Feb 13, 2024

Hi,
I think I observe the same bug when running the basic example with commit 7a64431.

Here are gifs made from the same program examples/basic/main.ml and the same tape file examples/basic/demo.tape:

demo_ok
demo_hang

It is not clear to me whether the EAGAIN errors are a problem, as the traces from a good run has a lot of them too.
Here are two traces for a good and a hanging run (the pointers have been renamed to reduce differences between the traces and simplify comparison):

strace_ok.txt
strace_hang.txt

I am on Arch Linux running OCaml 5.1.1 with pinned repositories for all the riot ecosystem.

@chshersh
Copy link
Author

A solution for #46 fixes the problem for me, so I'm happy to close this as a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

3 participants