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

Segmentation fault in linux when pressing space bar or tilde key #766

Open
josephreynolds1 opened this issue Feb 7, 2023 · 6 comments
Open

Comments

@josephreynolds1
Copy link

Segmentation fault in Linux when pressing space bar or tilde key.

This happens in the main screen menus or in game.

Issue happens on latest build from source.

@bradharding
Copy link
Owner

Thanks for letting me know. I'll look into it when I can. Any chance you could please provide a stack trace?

@josephreynolds1
Copy link
Author

mprotect(0x7fdf052d6000, 4096, PROT_READ) = 0
brk(0x55baa3d77000) = 0x55baa3d77000
poll([{fd=5, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=5, revents=POLLOUT}])
writev(5, [{iov_base="\22\0\7\0\v\0\2\255\1\0\0\6\0\0\0 \0\1\0\1\0\0\0\200\3444\v", iov_len=28}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 28 recvmsg(5, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable) clock_gettime(CLOCK_MONOTONIC_RAW, {tv_sec=188004, tv_nsec=759569602}) = 0 recvmsg(5, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\34\0\6\1\v\0\2\255\1\0\0\232\3454\v\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 32
recvmsg(5, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(5, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(5, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=12, events=POLLIN}], 1, 0) = 0 (Timeout)
poll([{fd=11, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
clock_gettime(CLOCK_MONOTONIC_RAW, {tv_sec=188004, tv_nsec=759732751}) = 0
recvmsg(5, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(5, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=12, events=POLLIN}], 1, 0) = 0 (Timeout)
poll([{fd=11, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
clock_gettime(CLOCK_MONOTONIC_RAW, {tv_sec=188004, tv_nsec=759841215}) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
+++ killed by SIGSEGV +++
Segmentation fault

@bradharding
Copy link
Owner

Sorry, I'm not sure what this. My best guess is its a problem with SDL, since it would call clock_gettime(). Since a sound is played when pressing the space or tilde keys, it could also be SDL_mixer. Does the segfault still happen if you use -nosound?

@bradharding
Copy link
Owner

After a bit of Googling, I found this which may help: OpenRCT2/OpenRCT2#6364

@josephreynolds1
Copy link
Author

Tried it with -nosound and still crashes as soon as you press the space bar or tilde at any point once doomretro is running.

bradharding referenced this issue Feb 16, 2023
More testing required, but SDL_iconv_utf8_ucs4() seems to do the trick!
bradharding added a commit that referenced this issue Feb 16, 2023
See comments on commit ca7f8ba and issue #766. @devnexen and @josephreynolds1, could you please confirm if this works?
@ismagilli
Copy link
Contributor

ismagilli commented Sep 28, 2023

mprotect(0x7fdf052d6000, 4096, PROT_READ) = 0
brk(0x55baa3d77000) = 0x55baa3d77000
poll([{fd=5, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=5, revents=POLLOUT}])
writev(5, [{iov_base="\22\0\7\0\v\0\2\255\1\0\0\6\0\0\0 \0\1\0\1\0\0\0\200\3444\v", iov_len=28}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 28 recvmsg(5, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable) clock_gettime(CLOCK_MONOTONIC_RAW, {tv_sec=188004, tv_nsec=759569602}) = 0 recvmsg(5, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\34\0\6\1\v\0\2\255\1\0\0\232\3454\v\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 32
recvmsg(5, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(5, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(5, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=12, events=POLLIN}], 1, 0) = 0 (Timeout)
poll([{fd=11, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
clock_gettime(CLOCK_MONOTONIC_RAW, {tv_sec=188004, tv_nsec=759732751}) = 0
recvmsg(5, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(5, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=12, events=POLLIN}], 1, 0) = 0 (Timeout)
poll([{fd=11, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout)
clock_gettime(CLOCK_MONOTONIC_RAW, {tv_sec=188004, tv_nsec=759841215}) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
+++ killed by SIGSEGV +++
Segmentation fault

This is not stack trace, it is output of strace utility (https://strace.io). To produce stack trace please use something like this (you need to install gdb debugger):

  1. Cloning git repo: git clone https://github.com/bradharding/doomretro;
  2. Enter doomretro dir: cd doomretro;
  3. Compile with debug info: cmake -B build_debug -S . -DCMAKE_BUILD_TYPE=Debug; cmake --build build_debug -- -j4;
    Now executable file can be found here: build_debug/doomretro;
  4. Run with debugger: gdb -- build_debug/doomretro ARGS where ARGS is doomretro arguments, for example, -iwad DOOM.WAD;
  5. Type run or r command in gdb to run program;
  6. When a problem occurs, type backtrace or bt command in gdb to display the call stack.

And it is better to use the "code" environment to insert the output of programs in issues. =)

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

No branches or pull requests

3 participants