TIC-80 icon indicating copy to clipboard operation
TIC-80 copied to clipboard

Closes immediately after opening on Linux (Ubuntu MATE 22.04)

Open electricbrass opened this issue 3 years ago • 3 comments

I installed the PRO deb and when I try to launch TIC-80, it shows up for a couple seconds and then immediately disappears (crashes?). If there's somewhere to look for a log or anything let me know.

I have tried both the PRO version of 1.0.2164, and 1.0.2241-dev.

Exit code is 141

electricbrass avatar Aug 06 '22 08:08 electricbrass

Try to call tic80 --soft to disable GPU rendering and see what happens.

nesbox avatar Aug 08 '22 06:08 nesbox

Same result. Closes after a second or two, exit code 141.

electricbrass avatar Aug 08 '22 06:08 electricbrass

I do have the same problem on Mint 21 Cinnamon (Ubuntu 22.04 based), also full screen seems to be not working as well. The free flatpak version however seems to work fine.

TomTheDragon avatar Aug 12 '22 11:08 TomTheDragon

I have the same problem in a source-built Pro version (on ref 7f4ad780d75d2cd8446f856f85ba293af70530eb). Debian Linux (in a chrome OS linux container). I took a few minutes to narrow down where it might be happening, and I can confirm that the callback at https://github.com/libuv/libuv/blob/9c3d692b3941a2a4171629fb52af2e1029c415e8/src/unix/linux-core.c#L462 gets called but never returns.

I will keep digging but I thought this info might help a maintainer understand what's happening.

adamlincoln avatar Nov 01 '22 01:11 adamlincoln

At the moment it looks like studio/net.c's onConnect() function gets called during this callback chain. If we keep following we can see that eventually, deep inside libuv, this calls write() at line 717 of libuv/src/unix/stream.c, which never returns. Based on my reading of write()'s manpage, this means that write() is setting EPIPE and raising SIGPIPE, consistent with exit code 141.

Now I'm looking for what should be on the other end of that pipe and why it's not listening.

adamlincoln avatar Nov 08 '22 04:11 adamlincoln

Instead of looking more at the other end of the pipe, I discovered this conversation in libuv's repo and then two examples of projects that consume libuv setting SIG_IGN for SIGPIPE. There's also this warning in nikhilm's uvbook. The problem only affects libuv in Linux, and the remedy appears to be to set signal(SIGPIPE, SIG_IGN).

I've confirmed in a local pro build on Linux that signal(SIGPIPE, SIG_IGN) at the top of main.c's start() function eliminates the crash. I can also confirm that the "save raw code to file" pro feature works fine, and I have no reason to think ignoring SIGPIPE causes any other problems with TIC-80. But I'll leave it to @nesbox to decide whether this is the best plan for TIC-80, and the change is trivial so it is probably not worth it for me to open a pull request.

I hope this helps anyone who is seeing this crash on Linux.

adamlincoln avatar Nov 09 '22 04:11 adamlincoln

I skimmed the conversation thread and ignoring SIGPIPE seems like a reasonable fix to me if no one else objects.

joshgoebel avatar Dec 04 '22 18:12 joshgoebel

Thanks to @adamlincoln added fix here b70316c07abb5d13093575a29c4c3b6fc4182271

nesbox avatar Jan 12 '23 22:01 nesbox