jdolan / quetoo

Quetoo ("Q2") is a free first person shooter based on id Tech2. GPL v2 license.
http://quetoo.org
204 stars 28 forks source link

Crash on r_restart / r_toggle_fullscreen #667

Closed M-Ro closed 2 years ago

M-Ro commented 2 years ago

Crash doesn't seem reliable, can sometimes be reproduced in the main menu (before loading a map, but its rare). Doesn't occur on every trigger (occasionally requires multiples)

Video initialization...
  Trying 1913x1074..
  Setting up OpenGL context..
  Renderer:   NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2
  Vendor:     NVIDIA Corporation
  Version:    3.3.0 NVIDIA 470.94
Video initialized 1920x1080 (1920x1080) fullscreen
libpng warning: iCCP: known incorrect sRGB profile
quetoo: s_mix.c:162: S_MixChannels: Assertion `ch->play.sample->buffer' failed.
Sys_Signal: Received signal 6

Sometimes it's a SIGABRT, sometimes it just segfaults.

jdolan commented 2 years ago

I can't reproduce this one on macOS, either. I just r_restarted about 30 times, 10 times at the menu, and then twice after loading each q2dm level. No crashes.

There is a crash in ObjectivelyMVC around updateHover that you will see fairly consistently if moving your mouse while the map is loading. But this seems different...

M-Ro commented 2 years ago

Oddly I can reproduce it easier with F11 (toggle fullscreen) than r_restart, but I'm presuming that's just luck. I've attached an entirely unhelpful backtrace from gdb below.

r_fullscreen will be changed on r_restart.
Video initialization...
  Trying 1913x1074..
  Setting up OpenGL context..
  Renderer:   NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2
  Vendor:     NVIDIA Corporation
  Version:    3.3.0 NVIDIA 470.94
Video initialized 1920x1080 (1920x1080) fullscreen
r_fullscreen will be changed on r_restart.
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
quetoo: s_mix.c:162: S_MixChannels: Assertion `ch->play.sample->buffer' failed.
--Type <RET> for more, q to quit, c to continue without paging--

Thread 1 "quetoo" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
49  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
#1  0x00007ffff7745536 in __GI_abort () at abort.c:79
#2  0x00007ffff774541f in __assert_fail_base (
    fmt=0x7ffff78ab978 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
    assertion=0x5555555c0135 "ch->play.sample->buffer", file=0x5555555c012d "s_mix.c",
    line=162, function=<optimized out>) at assert.c:92
#3  0x00007ffff7754212 in __GI___assert_fail (
    assertion=assertion@entry=0x5555555c0135 "ch->play.sample->buffer",
    file=file@entry=0x5555555c012d "s_mix.c", line=line@entry=162,
    function=function@entry=0x5555555c0198 <__PRETTY_FUNCTION__.3> "S_MixChannels")
    at assert.c:101
#4  0x000055555558cb8f in S_MixChannels (stage=stage@entry=0x5555555dcc40 <cl_stage>)
    at s_mix.c:162
#5  0x000055555558b8e0 in S_RenderStage (stage=stage@entry=0x5555555dcc40 <cl_stage>)
    at s_main.c:237
#6  0x0000555555560d0e in Cl_Frame (msec=msec@entry=1) at cl_main.c:666
#7  0x000055555555f884 in Frame (msec=1) at main.c:410
#8  main (argc=1, argv=0x7fffffffe778) at main.c:459
(gdb) quit
A debugging session is active.

    Inferior 1 [process 129100] will be killed.
M-Ro commented 2 years ago

A bit further info. I hacked in the following block before the assertion to get some debug output in S_MixChannels.

if (!ch->play.sample->buffer) {
  Com_Print("entity %d\n", ch->play.entity);
  Com_Print("media %s\n", ch->play.sample->media.name);
}

assert(ch->play.sample->buffer);

Which gave me the following output:

entity 1
media #players/common/step_default_2
quetoo: s_mix.c:167: S_MixChannels: Assertion `ch->play.sample->buffer' failed.
Sys_Signal: Received signal 6

It always seems to be a footstep file (grass, default, etc..). I realised if I just load a map, I can r_restart/r_toggle_fullscreen all day long, until I start moving and a footstep sound plays for the first time. The next restart will crash. This goes against my previous statement that it can happen in the main menu before loading a map, which I can't seem to reproduce. :thinking:

jdolan commented 2 years ago

Ah, this makes more sense now! Thank you.

jdolan commented 2 years ago

I can reproduce this exact crash, and debug it.

bind "mouse 2" r_toggle_fullscreen

And run around on the grass on Edge and hit mouse2.

jdolan commented 2 years ago

@M-Ro I think this is fixed now, if you want to retest.

M-Ro commented 2 years ago

@jdolan Confirmed - Spent ~10 minutes playing with bots spamming F11 across a few maps. No crashes.