naev / naev

Naev is a 2d action/rpg space game that combines elements from the action, rpg and simulation genres.
https://naev.org
Other
840 stars 202 forks source link

maikki2: Dr Strangelove, or how I learned to stop worrying and freeze to the music #1749

Closed amylaar closed 3 years ago

amylaar commented 3 years ago

After I talked to hologram projector AKA the terminal for a while, I went to leave, and naev froze up, with the music still playing. It still said that Strangelove's image flickers and disappears, although it didn't until I switched workspaces. When I did, and switched back, the screen wasn't redrawn. I haven't been able to reproduce the exact sequence, but found something, while a bit nonsentical, makes the problem weakly reproducible:

I think I got the game to hang on first approach once, but generally it doesn't. It hangs slightly more often on third approach than second approach, and overall maybe half the time for second&third approach combined. I tried more approaches but have not found any hang if it didn't hang on third approach. Hang/nonhang seem to come in runs, maybe related to memory allocation, address space randomization, or entropy for the random number generator?

I have also been able to reproduce the hang with keyboard-selected approach/leave, where it hung on the third leave, but only once; it mostly didn't hang when I selected with the keyboard.

Here is a backtrace from when I interrupt the hung naev in gdb:

0 futex_wait_cancelable (private=0, expected=0, futex_word=0x1f6434c)

at ../sysdeps/nptl/futex-internal.h:183

1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x1611700,

cond=0x1f64320) at pthread_cond_wait.c:508

2 __pthread_cond_wait (cond=0x1f64320, mutex=0x1611700)

at pthread_cond_wait.c:638

3 0x00007ffff7b9f5c2 in SDL_CondWait_REAL (cond=,

mutex=<optimized out>)
at /usr/src/debug/SDL2-2.0.14-1.fc33.x86_64/src/thread/pthread/SDL_syscond.c:152

4 0x000000000048cb75 in music_al_play () at ../src/music_openal.c:800

5 0x000000000048b582 in music_play () at ../src/music.c:350

6 0x00000000004f969e in musicL_play (L=)

at ../src/nlua_music.c:131

7 0x000000000053d485 in lj_BC_FUNCC () at buildvm_x86.dasc:849

8 0x000000000052f49a in lua_pcall (L=L@entry=0x7fffe13df380,

nargs=nargs@entry=3, nresults=nresults@entry=1, errfunc=errfunc@entry=-5)
at ../subprojects/luajit/src/lj_api.c:1169

9 0x0000000000507571 in cust_pcall (L=L@entry=0x7fffe13df380,

nargs=nargs@entry=3, nresults=nresults@entry=1, cf=cf@entry=0x7fffffffccf0)
at ../src/nlua_tk.c:525

10 0x000000000050782e in cust_key (key=32, mod=KMOD_NONE,

pressed=pressed@entry=1, cf=0x7fffffffccf0) at ../src/nlua_tk.c:604

11 0x0000000000507941 in cust_event (wid=,

event=<optimized out>, data=<optimized out>) at ../src/nlua_tk.c:586

12 0x000000000044995e in dialogue_custom_event (wid=12, event=0x7fffffffcbb0)

at ../src/dialogue.c:875

13 0x00000000004dee8d in toolkit_inputWindow (wdw=0x3e74ed0,

event=event@entry=0x7fffffffcbb0, purge=purge@entry=1)
at ../src/toolkit.c:1601

14 0x00000000004df254 in toolkit_input (event=event@entry=0x7fffffffcbb0)

at ../src/toolkit.c:1576

15 0x000000000046cf24 in input_handle (event=event@entry=0x7fffffffcbb0)

at ../src/input.c:1551

16 0x0000000000449613 in toolkit_loop (

loop_done=loop_done@entry=0x7fffffffcc4c, du=du@entry=0x7fffffffcc50)
at ../src/dialogue.c:1053

17 0x000000000044ad12 in dialogue_custom (

caption=caption@entry=0x7fffb3587208 "LÖVE", width=1371, width@entry=-1, 
height=692, height@entry=-1, update=update@entry=0x507949 <cust_update>, 
render=render@entry=0x50772a <cust_render>, 
event=event@entry=0x507860 <cust_event>, data=0x7fffffffccf0)
at ../src/dialogue.c:941

18 0x00000000005074bd in tk_custom (L=0x7fffe13df380) at ../src/nlua_tk.c:399

19 0x000000000053d485 in lj_BC_FUNCC () at buildvm_x86.dasc:849

20 0x000000000052f49a in lua_pcall (L=0x7fffe13df380, nargs=nargs@entry=1,

nresults=nresults@entry=0, errfunc=errfunc@entry=-3)
at ../subprojects/luajit/src/lj_api.c:1169

21 0x0000000000493d57 in nlua_pcall (env=env@entry=225, nargs=nargs@entry=1,

nresults=nresults@entry=0) at ../src/nlua.c:642

22 0x00000000004f93ab in misn_runFunc (misn=,

func=0x2882960 "approach_eccentric", nargs=nargs@entry=1)
at ../src/nlua_misn.c:243

23 0x0000000000494a52 in npc_approach (i=i@entry=0) at ../src/npc.c:587

24 0x00000000004705f8 in bar_approach (wid=9, str=)

at ../src/land.c:519

25 0x00000000004de9c2 in toolkit_mouseEventWidget (w=w@entry=0x44ab400,

wgt=wgt@entry=0x3c05480, event=event@entry=0x7fffffffcfb0, 
x=<optimized out>, y=30, rx=<optimized out>, ry=0) at ../src/toolkit.c:1829

26 0x00000000004deaa8 in toolkit_mouseEvent (w=w@entry=0x44ab400,

event=event@entry=0x7fffffffcfb0) at ../src/toolkit.c:1715

27 0x00000000004deed5 in toolkit_inputWindow (wdw=0x44ab400,

event=event@entry=0x7fffffffcfb0, purge=purge@entry=0)
at ../src/toolkit.c:1615

28 0x00000000004e86c6 in tab_raw (tab=0x7fffac006260, event=0x7fffffffcfb0)

at ../src/tk/widget/tabwin.c:213

29 0x00000000004dee73 in toolkit_inputWindow (wdw=0x3825740,

event=event@entry=0x7fffffffcfb0, purge=purge@entry=1)
at ../src/toolkit.c:1592

30 0x00000000004df254 in toolkit_input (event=event@entry=0x7fffffffcfb0)

at ../src/toolkit.c:1576

31 0x000000000046cf24 in input_handle (event=event@entry=0x7fffffffcfb0)

at ../src/input.c:1551

32 0x000000000048ec05 in main (argc=, argv=)

at ../src/naev.c:408

(gdb)

bobbens commented 3 years ago

Yeah, going to have to rewrite the music stuff. Was hoping I could avoid that, but I guess I pushed the current code past its limit ;)

bobbens commented 3 years ago

This shouldn't happen any more in main, thanks!