nesbox / TIC-80

TIC-80 is a fantasy computer for making, playing and sharing tiny games.
https://tic80.com
MIT License
4.86k stars 466 forks source link

[0.90 - linux] Tic-80 freezes the system when window focus is gained after a long time #1506

Open ddelemeny opened 2 years ago

ddelemeny commented 2 years ago

(Hi there, long time no see)

Version : pro 4fdbdec OS: ubuntu 21.04

On focus gained, the process seems to be stuck in the event loop, leaving me no option other than to wait (sometimes a few minutes) or restart the computer.

nesbox commented 2 years ago

Hi, thank you for the report, will check it asap...

ddelemeny commented 2 years ago

Hi @nesbox, do you have any clue about what could cause this behavior ? It's making 0.90 quite unusable for me atm, I would be happy to try to fix it but the system-wide freezes make reproducing and bisecting the bug a bit... tedious.

nesbox commented 2 years ago

Hi, I still don't know the reason, we could try to downgrade the SDL to 2.0.11 as it was in 0.80 and check...

ddelemeny commented 2 years ago

I tried downgrading sdl to the release-2.0.12 tag (no tag for 2.0.11), still freezing.

Are you able to reproduce the bug ? I'd like to find a way to trigger this behavior more deterministically than "just wait until it f*cks up"

nesbox commented 2 years ago

Unfortunately I can't reproduce it but I suspect one commit. Could you pls try to check on this commit 352d0f6. Thank you.

ddelemeny commented 2 years ago

It seems to be way older than that. As of now, I can tell that 0.80 wasn't affected, and that c6d246e0d9 was. Still trying to narrow down the "not affected" side of the interval with more confidence, but that has to be the most tedious and frustrating bughunt I've done ever.

nesbox commented 2 years ago

We hope only for you :)

ddelemeny commented 2 years ago

From the commits remaining in the bisect interval, I'm suspecting one of d76902988ed0d0a73307dd0784db34e4dc9a304f (known bad) or 871f18aa78d76384f74b3dc3579c13c513b2bb37 (not tested yet) to have uncovered a weird driver-related issue. That would explain why I seem to be the only one affected and why it's affecting the whole system.

ddelemeny commented 2 years ago

Bisection finished, the result is that 871f18aa78d76384f74b3dc3579c13c513b2bb37 uncovered something nasty looming under the surface.

That driver-related issue hunch seems to be prolific indeed : at the other end of this rabbit hole there is a plethora of i915 related system freezes and GPU hangs, as the i915 driver seems to be a hot mess since the 5.1 kernel line came about (I'm on linux 5.11, ubuntu 21.04 on wayland).

Unfortunately, I'm not able to confirm my condition is of the same nature because nothing appears in the system logs.

So I'll start shooting in the dark.

nesbox commented 2 years ago

Great, now the question is, are you using the -DBUILD_SDLGPU=ON flag to build the app? Depending on your answer, the problem is caused by SDL2 lib or SDLGPU lib.

ddelemeny commented 2 years ago

Nope. Not using that flag.

nesbox commented 2 years ago

Could you pls enable BUILD_SDLGPU and try to reproduce it?

ddelemeny commented 2 years ago

Could you pls enable BUILD_SDLGPU and try to reproduce it?

I'll try that.

Another piece of the puzzle : switching from wayland to xorg seems to work without freezing.

aliceisjustplaying commented 2 months ago

@ddelemeny is this still an issue?

ddelemeny commented 1 month ago

I haven't tinkered with TIC in a long time, maybe ask the community if anyone with the driver mentioned above has encountered any issues on wayland recently ? Anyway, closable issue on my end if nobody else wants to hunt this one.