libsdl-org / sdl12-compat

An SDL-1.2 compatibility layer that uses SDL 2.0 behind the scenes.
Other
191 stars 40 forks source link

more icebreaker issues (crash on startup) #304

Open mattdm opened 1 year ago

mattdm commented 1 year ago

Over 20 years ago, I wrote a game called Icebreaker. People still like it! Someone already addressed one issue with it here (amazing!) — #68

However, with Fedora Linux 35 it started having hard-to-reproduce crash-on-startup issues. As of F38, it seems to crash on startup all the time, so... progress?

I will freely admit this is not good code. I should re-write it all -- it still might not be good code, but at least I'll be using Bevy Engine and Rust rather than making everything up and not knowing how to do memory management in C so it's just a bunch of arrays. :)

But, until that time, which may never come.... it's not working, and figuring it out alone is beyond me.

I get...

Thread 3 "icebrea:disk$0" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe7fff6c0 (LWP 334025)]
0x0000000000418800 in flock ()
(gdb) bt
#0  0x0000000000418800 in flock ()
#1  0x00007ffff48bbbfc in disk_cache_write_item_to_disk
    (dc_job=dc_job@entry=0x7fffd403e6b0, filename=filename@entry=0x7fffe0000b70 "/home/mattdm/.cache/mesa_shader_cache/0a/3f0df508dae8286fb2ffd4379e8b34176ddb05")
    at ../src/util/disk_cache_os.c:765
#2  0x00007ffff48ba185 in cache_put (job=job@entry=0x7fffd403e6b0, gdata=gdata@entry=0x0, thread_index=thread_index@entry=0) at ../src/util/disk_cache.c:460
#3  0x00007ffff48c3e41 in util_queue_thread_func (input=input@entry=0x5c7350) at ../src/util/u_queue.c:309
#4  0x00007ffff4912ecc in impl_thrd_routine (p=<optimized out>) at ../src/c11/impl/threads_posix.c:67
#5  0x00007ffff7dd3907 in start_thread (arg=<optimized out>) at pthread_create.c:444
#6  0x00007ffff7e59870 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
(gdb) 

User reports at https://discussion.fedoraproject.org/t/icebreaker-on-fedora-35-and-sadly-up/35254/7 and https://bugzilla.redhat.com/show_bug.cgi?id=2048689

If someone could help, that would be amazing.

smcv commented 1 year ago

For what it's worth, it seemed OK when run with sdl12-compat on Debian 12, when I tried to test all the remaining SDL 1.2 games in Debian.

mattdm commented 1 year ago

FWIW, whatever is happening is happening very early, in the call to SDL_SetVideoMode().

I would like to emphasize again the possibility that I did something very stupid in the code, or in the hand-crafted makefile.

icculus commented 1 year ago

making everything up and not knowing how to do memory management in C so it's just a bunch of arrays. :)

Honestly, I have such an affection for these sort of programs, because you powered through it and built a whole game anyway.

The icebrea:disk$0 thread is the Mesa shader cache, so the stack trace is probably a red herring, and memory is corrupting elsewhere.

I couldn't reproduce it on Ubuntu (and valgrind reports no incorrect memory accesses), but I'll try to get this running on Fedora a little later on and see if something goes south for me.