Openrct2: Immediate segmentation fault with sdl2 2.0.6

Created on 4 Oct 2017  路  18Comments  路  Source: OpenRCT2/OpenRCT2


OS: Arch Linux
Version: 0.1.2-makepkg & 0.1.1-master (via openrct2-git & openrct2 from AUR; both tested)
Commit/Build: cbe5b1dee & f25e730


Edit: This happens when the sdl2 package is upgraded to 2.0.6 (Arch package 2.0.6-1).

I updated my system yesterday, and upon starting OpenRCT2, this error appears (using --verbose):

...
VERBOSE:   entry: { 0x0C58B689, "WTRCYAN ", 0xBB93DD7D }
VERBOSE:   size: 1310
VERBOSE: CreateObjectFromLegacyFile("/home/max/.config/OpenRCT2/game-data/ObjData/STEX2.DAT")
VERBOSE:   entry: { 0x0C58B78A, "STEX2   ", 0xA39A9CF2 }
VERBOSE:   size: 2605
VERBOSE: 0 / 0 objects unloaded
VERBOSE: 158 / 158 new objects loaded
VERBOSE: TitleSequencePlayer::LoadParkFromStream(SpacekKing.sv6)
VERBOSE: saved game classic_flag = 0x00

VERBOSE: 0 / 158 objects unloaded
VERBOSE: 0 / 158 new objects loaded
VERBOSE: TitleScreen::Load() finished
VERBOSE: begin openrct2 loop
VERBOSE: MemoryAudioSource::LoadWAV(/home/max/.config/OpenRCT2/game-data/Data/css2.dat)
Segmentation fault (core dumped)

...and from strace (without --verbose):

...
clock_gettime(CLOCK_MONOTONIC_RAW, {tv_sec=3248, tv_nsec=431079287}) = 0
recvmsg(9, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
select(10, [9], NULL, NULL, {tv_sec=0, tv_usec=0}) = 0 (Timeout)
nanosleep({tv_sec=0, tv_nsec=24000000}, NULL) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {tv_sec=3248, tv_nsec=455247445}) = 0
recvmsg(9, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
select(10, [9], NULL, NULL, {tv_sec=0, tv_usec=0}) = 0 (Timeout)
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2845, ...}) = 0
openat(AT_FDCWD, "/home/max/.config/OpenRCT2/game-data/Data/css2.dat", O_RDONLY) = 19
fstat(19, {st_mode=S_IFREG|0644, st_size=3024264, ...}) = 0
read(19, "RIFF\200%.\0WAVEfmt \20\0\0\0\1\0\2\0\"V\0\0\210X\1\0"..., 4096) = 4096
read(19, "\254\364\205\4\370\362k\1\353\357m\374\276\360L\365\262\361/\360!\366<\361\347\367\35\3611\373\256\363"..., 3018752) = 3018752
read(19, "~\374\261\361}\375\204\363\233\376\200\366I\1j\373\2\0047\377\364\2\2\1\231\3\362\2\242\3<\2"..., 4096) = 1416
lseek(19, 0, SEEK_CUR)                  = 3024264
close(19)                               = 0
mmap(NULL, 24195072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8570949000
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x7ffdb1a3c000} ---
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault (core dumped)

When sound is turned off in config.ini or css2.dat is moved to a different location, the game starts and runs fine albeit without sound. I'm currently attempting to downgrade packages to find the culprit, but this should be reproducible with a new Arch Linux install (perhaps test in a VM?).

Steps taken:

  • Checked the data files for corruption by comparing checksums with the original game data.
  • Moved ~/.config/OpenRCT2 to a temporary place to regenerate user data.
  • Built against latest dev sources and latest stable sources.
crash

Most helpful comment

Yes, I looked into it yesterday and it looks very much like a regression in sdl2's new audio code. I'm reluctant to point a finger just yet, I am looking into how the code is meant to be used, to make sure we don't do something wrong, but that said I can clearly see the regression begins with https://github.com/spurious/SDL-mirror/commit/4509de166f53336fcce88bd3e7c6cc5fdb782e4a. I will try working on sdl2 today.

All 18 comments

Just installed OpenRCT2 in an updated Arch Linux VM and the error is reproducible. Moving css2.dat makes the game run reliably as well.

Here's the pacman.log of what was updated before the segfaults:

[2017-10-02 10:07] [PACMAN] Running 'pacman -S -y -u'
[2017-10-02 10:07] [PACMAN] synchronizing package lists
[2017-10-02 10:07] [PACMAN] starting full system upgrade
[2017-10-02 10:07] [ALPM] running '70-dkms-remove.hook'...
[2017-10-02 10:07] [ALPM] running 'texinfo-remove.hook'...
[2017-10-02 10:07] [ALPM] transaction started
[2017-10-02 10:07] [ALPM] upgraded alsa-lib (1.1.4.1-1 -> 1.1.4.1-2)
[2017-10-02 10:07] [ALPM] upgraded autoconf-archive (1:2017.03.21-1 -> 1:2017.09.28-1)
[2017-10-02 10:07] [ALPM] upgraded libutil-linux (2.30.1-2 -> 2.30.2-1)
[2017-10-02 10:07] [ALPM] upgraded util-linux (2.30.1-2 -> 2.30.2-1)
[2017-10-02 10:07] [ALPM] upgraded dbus (1.10.22-1 -> 1.10.24-1)
[2017-10-02 10:07] [ALPM] upgraded device-mapper (2.02.174-1 -> 2.02.174-2)
[2017-10-02 10:08] [ALPM] upgraded linux (4.12.13-1 -> 4.13.3-1)
[2017-10-02 10:08] [ALPM-SCRIPTLET] >>> Updating module dependencies. Please wait ...
[2017-10-02 10:08] [ALPM] upgraded bbswitch (0.8-78 -> 0.8-80)
[2017-10-02 10:08] [ALPM] upgraded ca-certificates-mozilla (3.32-1 -> 3.33-1)
[2017-10-02 10:08] [ALPM] upgraded cmake (3.9.2-2 -> 3.9.3-1)
[2017-10-02 10:08] [ALPM] upgraded imagemagick (6.9.9.15-1 -> 6.9.9.17-1)
[2017-10-02 10:08] [ALPM] upgraded nss (3.32-1 -> 3.33-1)
[2017-10-02 10:08] [ALPM] upgraded cups-filters (1.17.7-1 -> 1.17.8-1)
[2017-10-02 10:08] [ALPM] upgraded evemu (2.6.0-1 -> 2.7.0-1)
[2017-10-02 10:08] [ALPM] upgraded faac (1.29.3-1 -> 1.29.7.7-1)
[2017-10-02 10:08] [ALPM] upgraded faad2 (2.8.1-1 -> 2.8.5-1)
[2017-10-02 10:08] [ALPM] upgraded git (2.14.1-1 -> 2.14.2-1)
[2017-10-02 10:08] [ALPM] upgraded gocr (0.50-2 -> 0.51-1)
[2017-10-02 10:08] [ALPM] upgraded vim-runtime (8.0.1127-1 -> 8.0.1159-1)
[2017-10-02 10:08] [ALPM] upgraded nvidia-utils (384.69-1 -> 384.90-1)
[2017-10-02 10:08] [ALPM-SCRIPTLET] If you run into trouble with CUDA not being available, run nvidia-modprobe first.
[2017-10-02 10:08] [ALPM] upgraded gvim (8.0.1127-1 -> 8.0.1159-1)
[2017-10-02 10:08] [ALPM] upgraded lib32-nvidia-utils (384.69-1 -> 384.90-1)
[2017-10-02 10:08] [ALPM] upgraded libmariadbclient (10.1.26-1 -> 10.1.28-1)
[2017-10-02 10:08] [ALPM] upgraded libmtp (1.1.13-1 -> 1.1.14-1)
[2017-10-02 10:08] [ALPM] upgraded libsodium (1.0.13-1 -> 1.0.14-1)
[2017-10-02 10:08] [ALPM] upgraded lvm2 (2.02.174-1 -> 2.02.174-2)
[2017-10-02 10:08] [ALPM] upgraded mariadb-clients (10.1.26-1 -> 10.1.28-1)
[2017-10-02 10:08] [ALPM] upgraded mariadb (10.1.26-1 -> 10.1.28-1)
[2017-10-02 10:08] [ALPM] upgraded npm (5.3.0-1 -> 5.4.2-1)
[2017-10-02 10:08] [ALPM] upgraded nvidia (384.69-2 -> 384.90-1)
[2017-10-02 10:08] [ALPM-SCRIPTLET] In order to use nvidia module, reboot the system.
[2017-10-02 10:08] [ALPM] upgraded opencl-nvidia (384.69-1 -> 384.90-1)
[2017-10-02 10:08] [ALPM] upgraded pciutils (3.5.4-1 -> 3.5.5-1)
[2017-10-02 10:08] [ALPM] upgraded rsync (3.1.2-2 -> 3.1.2-3)
[2017-10-02 10:08] [ALPM] upgraded sdl2 (2.0.5-4 -> 2.0.6-1)
[2017-10-02 10:08] [ALPM] upgraded virtualbox-host-modules-arch (5.1.28-1 -> 5.1.28-3)
[2017-10-02 10:08] [ALPM] upgraded wine (2.17-1 -> 2.18-1)
[2017-10-02 10:08] [ALPM] transaction completed
[2017-10-02 10:08] [ALPM] running '70-dkms-install.hook'...
[2017-10-02 10:08] [ALPM] running '90-linux.hook'...
[2017-10-02 10:08] [ALPM-SCRIPTLET] ==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
[2017-10-02 10:08] [ALPM-SCRIPTLET] ==> Starting build: 4.13.3-1-ARCH
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [base]
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [udev]
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [autodetect]
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [modconf]
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [block]
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [filesystems]
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [keyboard]
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [fsck]
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [lvm2]
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [encrypt]
[2017-10-02 10:08] [ALPM-SCRIPTLET] ==> Generating module dependencies
[2017-10-02 10:08] [ALPM-SCRIPTLET] ==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img
[2017-10-02 10:08] [ALPM-SCRIPTLET] ==> Image generation successful
[2017-10-02 10:08] [ALPM-SCRIPTLET] ==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
[2017-10-02 10:08] [ALPM-SCRIPTLET] ==> Starting build: 4.13.3-1-ARCH
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [base]
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [udev]
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [modconf]
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [block]
[2017-10-02 10:08] [ALPM-SCRIPTLET] ==> WARNING: Possibly missing firmware for module: wd719x
[2017-10-02 10:08] [ALPM-SCRIPTLET] ==> WARNING: Possibly missing firmware for module: aic94xx
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [filesystems]
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [keyboard]
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [fsck]
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [lvm2]
[2017-10-02 10:08] [ALPM-SCRIPTLET]   -> Running build hook: [encrypt]
[2017-10-02 10:08] [ALPM-SCRIPTLET] ==> Generating module dependencies
[2017-10-02 10:08] [ALPM-SCRIPTLET] ==> Creating gzip-compressed initcpio image: /boot/initramfs-linux-fallback.img
[2017-10-02 10:08] [ALPM-SCRIPTLET] ==> Image generation successful
[2017-10-02 10:08] [ALPM] running 'detect-old-perl-modules.hook'...
[2017-10-02 10:08] [ALPM-SCRIPTLET] WARNING: '/usr/lib/perl5/vendor_perl' contains data from at least 5 packages which will NOT be used by the installed perl interpreter.
[2017-10-02 10:08] [ALPM-SCRIPTLET]  -> Run the following command to get a list of affected packages: pacman -Qqo '/usr/lib/perl5/vendor_perl'
[2017-10-02 10:08] [ALPM] running 'gtk-update-icon-cache.hook'...
[2017-10-02 10:08] [ALPM] running 'systemd-hwdb.hook'...
[2017-10-02 10:08] [ALPM] running 'systemd-sysusers.hook'...
[2017-10-02 10:08] [ALPM] running 'systemd-tmpfiles.hook'...
[2017-10-02 10:08] [ALPM] running 'systemd-update.hook'...
[2017-10-02 10:08] [ALPM] running 'texinfo-install.hook'...
[2017-10-02 10:08] [ALPM] running 'update-ca-trust.hook'...
[2017-10-02 10:08] [ALPM] running 'update-desktop-database.hook'...
[2017-10-02 10:08] [ALPM] running 'update-mime-database.hook'...
[2017-10-02 10:09] [PACMAN] Running 'pacman -Ud --ask 36 --noconfirm /home/max/.cache/pacaur/slack-desktop/slack-desktop-2.8.1-1-x86_64.pkg.tar'
[2017-10-02 10:09] [ALPM] transaction started
[2017-10-02 10:09] [ALPM] upgraded slack-desktop (2.8.0-1 -> 2.8.1-1)
[2017-10-02 10:09] [ALPM] transaction completed
[2017-10-02 10:09] [ALPM] running 'systemd-update.hook'...
[2017-10-02 10:09] [ALPM] running 'update-desktop-database.hook'...

Found it. Looks like SDL2 is the culprit. Downgrading to sdl2 version 2.0.5-4 makes OpenRCT2 work without segfaults, and the sound works just fine.

Yes, I looked into it yesterday and it looks very much like a regression in sdl2's new audio code. I'm reluctant to point a finger just yet, I am looking into how the code is meant to be used, to make sure we don't do something wrong, but that said I can clearly see the regression begins with https://github.com/spurious/SDL-mirror/commit/4509de166f53336fcce88bd3e7c6cc5fdb782e4a. I will try working on sdl2 today.

This has been bugging me for a few hours. Can confirm downgrading SDL2 solves the issue, for now.

Is there an bug on this for sdl?

Yes, it's tracked in #3858 (and potentially #3848, #3849)

ok thanks, If someone would build libsdl2 with options=(debug !strip) added to the pkgbuild it would provide better debug information.

there's no need, really. it is tracked upstream and already assigned, which I presume means it is already worked on. it affects many projects, not just us.

It seems to be fixed in libsdl, according to #3858, but no idea when this will be available in the repositories.

Can confirm this is a problem on MacOS as well. Unfortunately the version that is shipped with brew is 2.0.6 and no other version.

It seems to be fixed in libsdl, according to #3858, but no idea when this will be available in the repositories.

I can confirm that installing the master version of sdl2 in Arch Linux fixes this bug. (It's sdl2-hg in the AUR.)

As SDL 2.0.7 is out and addresses this particular issue, I'm going to close it.

Perfect! Thanks so much!

Sorry to reopen, But i'm having this issue except i'm using Ubuntu 17.10. This mean SDL is harder to update.

Is my only hope to rebuild sdl from source, or should I ask the ubuntu repos to update?

The issue is purely within sdl2, you have to update. I'm fairly sure others have run into the same issue and it's not unreasonable to expect there would be a PPA with updated version.

@zayuim Ubuntu repos can be slightly slow sometimes. You might want to look at checkinstall for an easy way to install un-packaged software or versions.

I can confirm that upgrading libsdl2-2.0-0 to 2.0.7 version solves the issue.
Link to newest version is this (Ubuntu): https://packages.ubuntu.com/bionic/libsdl2-2.0-0.

Thanks for anyone who found the solution!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Xaroth picture Xaroth  路  3Comments

telk5093 picture telk5093  路  3Comments

Superjustinbros picture Superjustinbros  路  3Comments

wildgoosespeeder picture wildgoosespeeder  路  3Comments

Wirlie picture Wirlie  路  3Comments