Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Engine crash in input code if no display is available #983

Open
illwieckz opened this issue Dec 4, 2023 · 2 comments
Open

Engine crash in input code if no display is available #983

illwieckz opened this issue Dec 4, 2023 · 2 comments

Comments

@illwieckz
Copy link
Member

illwieckz commented Dec 4, 2023

The engine crashes in input code if no display is available

This is not a big issue because the game can't run anyway, but the engine should shutdown properly instead of crashing.

I reproduce it in a chroot without display set, I guess an easier way to reproduce it is to try to run the game over SSH without X fowarding.

--- Common Initialization Complete ---
Calling GetRefAPI…
SDL_Init( SDL_INIT_VIDEO )...
Using SDL version 2.24.0
]error: XDG_RUNTIME_DIR is invalid or not set in the environment.
SDL_Init( SDL_INIT_VIDEO ) failed: No available video device
Setting r_mode -1 failed, falling back on r_mode 3
SDL_Init( SDL_INIT_VIDEO )...
Using SDL version 2.24.0
]error: XDG_RUNTIME_DIR is invalid or not set in the environment.
SDL_Init( SDL_INIT_VIDEO ) failed: No available video device
]
Thread 1 "daemon" received signal SIGSEGV, Segmentation fault.
0x000000000061c0f8 in IN_SetMouseMode (newMode=SystemCursor) at Unvanquished/daemon/src/engine/sys/sdl_input.cpp:437
437		if ( in_nograb->integer && newMode == MouseMode::Deltas )

Thread 3 (Thread 0x7ffff51f86c0 (LWP 2730331) "daemon"):
#0  0x00007ffff71203df in __libc_accept (fd=4, addr=..., len=0x0) at ../sysdeps/unix/sysv/linux/accept.c:26
#1  0x0000000000949fe2 in Sys::ReadSingletonSocket () at Unvanquished/daemon/src/engine/framework/System.cpp:246
#2  0x00007ffff74dc3a3 in std::execute_native_thread_routine (__p=0x1aa88e0) at ../../../../../src/libstdc++-v3/src/c++11/thread.cc:82
#3  0x00007ffff7090402 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#4  0x00007ffff711f590 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Thread 2 (Thread 0x7ffff5a506c0 (LWP 2730330) "daemon"):
#0  0x00007ffff70ddaf1 in __GI___clock_nanosleep (clock_id=clock_id@entry=0, flags=flags@entry=0, req=req@entry=0x7ffff5a4fa40, rem=rem@entry=0x7ffff5a4fa40) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:78
#1  0x00007ffff70e2827 in __GI___nanosleep (req=req@entry=0x7ffff5a4fa40, rem=rem@entry=0x7ffff5a4fa40) at ../sysdeps/unix/sysv/linux/nanosleep.c:25
#2  0x00007ffff70e275e in __sleep (seconds=0) at ../sysdeps/posix/sleep.c:55
#3  0x000000000094b985 in _INTERNAL53845909::Sys::SignalThread () at Unvanquished/daemon/src/engine/framework/System.cpp:389
#4  0x00007ffff74dc3a3 in std::execute_native_thread_routine (__p=0x7ffff5a4fbb4) at ../../../../../src/libstdc++-v3/src/c++11/thread.cc:82
#5  0x00007ffff7090402 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#6  0x00007ffff711f590 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Thread 1 (Thread 0x7ffff5a56500 (LWP 2730327) "daemon"):
#0  0x000000000061c0f8 in IN_SetMouseMode (newMode=SystemCursor) at Unvanquished/daemon/src/engine/sys/sdl_input.cpp:437
#1  0x000000000061c070 in IN_Shutdown () at Unvanquished/daemon/src/engine/sys/sdl_input.cpp:1345
#2  0x000000000082e6b4 in GLimp_Shutdown () at Unvanquished/daemon/src/engine/sys/sdl_glimp.cpp:346
#3  0x0000000000752bea in RE_Shutdown (destroyWindow=true) at Unvanquished/daemon/src/engine/renderer/tr_init.cpp:1519
#4  0x000000000057acdc in CL_ShutdownRef () at Unvanquished/daemon/src/engine/client/cl_main.cpp:2338
#5  CL_StartHunkUsers () at Unvanquished/daemon/src/engine/client/cl_main.cpp:2215
#6  0x0000000000952956 in _INTERNAL53845909::Sys::Init (argc=2, argv=0x1b916f0) at Unvanquished/daemon/src/engine/framework/System.cpp:721
#7  0x0000000000949a69 in main (argc=2, argv=0x1b916f0) at Unvanquished/daemon/src/engine/framework/System.cpp:741
@illwieckz illwieckz changed the title The engine crashes in input code if no display is available Engine crash in input code if no display is available Dec 4, 2023
@illwieckz
Copy link
Member Author

illwieckz commented Dec 4, 2023

A simple way to reproduce the crash is to set SDL_VIDEODRIVER=wayland in environment while being on X11, this way the game finds no display, so we can reproduce the crash that happens when there is no display.

Using SDL version 2.28.3 
SDL_Init( SDL_INIT_VIDEO ) failed: wayland not available 
]
Thread 1 "daemon" received signal SIGSEGV, Segmentation fault.
0x000055555561e71a in IN_SetMouseMode (newMode=newMode@entry=MouseMode::SystemCursor) at Unvanquished/daemon/src/engine/sys/sdl_input.cpp:437
437		if ( in_nograb->integer && newMode == MouseMode::Deltas )

@slipher
Copy link
Member

slipher commented Dec 4, 2023

It it's crashing by dereferencing in_nograb I guess we can fix it by migrating the cvar to Cvar::Cvar<bool>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants