Opened 11 years ago

Closed 4 years ago

#6387 closed defect (fixed)

BACKENDS: Android - Error handling ends in segfault

Reported by: SF/mschomburg Owned by: antoniou79
Priority: normal Component: Port: Android
Version: Keywords:
Cc: Game:

Description

I possess a 2-CD version of T7G (The Seventh Guest). On Windows 7 64-Bit, ScummVM successfully starts the game from the files I copied from the CDs to my HDD. Meanwhile, ScummVM on Android crashes upon starting the very same files. Nexus 10 Tablet / Android 4.3 ScummVM 1.5.0 ScummVM Plugin: groovie 1.5.0

I only receive a popup (german language) "ScummVM wurde beendet" (ScummVM exited).

No clue where to find additional hints or what the problem is.

Any help appreciated.

Ticket imported from: #3614882. Ticket imported from: bugs/6387.

Change History (23)

comment:1 by digitall, 11 years ago

Summary: T7G crashes ScummVM on AndroidGROOVIE: T7G on Android crashes

comment:2 by digitall, 11 years ago

mschomburg: Thank you for the bug report.

This could be a subtle corrupted, missing or variant datafile issue.

Please could you attach a text file to this bug containing a file listing of your T7G datafiles, preferably with file md5sums? The output of a tool such as this: http://md5summer.org or other tool from http://wiki.scummvm.org/index.php/Reporting_unknown_MD5_checksums would be optimal. This can be done on the PC.

I would also suggest that you try using the latest v1.6.0 stable and/or v1.7.0git development build on Android to see if the crash disappears. These can be found here: http://buildbot.scummvm.org/builds.html

You will need to download the relevant zip and using a file manager such as Ghostcommander, decompress the zip to apks, then uninstall the marketplace/play store version of ScummVM and all plugins and install the version from the APKs supplied (You will need to enable third party installation in settings temporarily).

comment:3 by digitall, 11 years ago

Apart from that, you can help us by providing the relevant section of the Android Debug Log: http://wiki.scummvm.org/index.php/Debugging_ScummVM#Android

comment:4 by SF/mschomburg, 11 years ago

Installed Android SDK and enabled USB debugging.

Output gave

E/ScummVM (25311): Groovie::Music: fat.ad not found! F/libc (25311): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 25324 (ScummVM)

Among the files, I have fat.mt and fat.opl, but not fat.ad.

Therefore I changed the game options to override the generic settings:

Audio Override global audio settings Music Driver: Embedded Audio Synthesis

Now it works. Thanks for giving the hint concerning adb and logcat (I somehow had the impression I needed a rooted device for that ... now I know how to get such info, and here it gave the necessary clue.)

comment:5 by SF/mschomburg, 11 years ago

Resolution: fixed
Status: newclosed

comment:6 by SF/mthreepwood, 11 years ago

Resolution: fixed
Status: closednew

comment:7 by SF/mthreepwood, 11 years ago

It still shouldn't crash, this is still a bug.

comment:8 by digitall, 11 years ago

Owner: set to scott-t

comment:9 by digitall, 11 years ago

This is not a crash per se. The engine is erroring out when the file "fat.ad" is not found.

This is being triggered from line 496 which calls error() in the file engines/groovie/music.cpp from within the function: void MusicPlayerXMI::loadTimbres(const Common::String &filename)

scott_t: Any idea/POV about this?

comment:10 by scott-t, 11 years ago

I haven't seen a variant without that file yet - even GoG and DotEmu have the three fat files (mt, opl and ad) - so not sure why it could be missing. Accidentally missed when copying from the discs or to the Android device perhaps?

That said, personal preference for Android is to use EAS as it sounds awesome anyway, but I know clone2727 will argue for Adlib all night ;)

comment:11 by SF/mschomburg, 11 years ago

My apologies, guys.

Double-checked it.

Must have been some copy problem - fat.ad is indeed on my original CD-ROMs. Cannot explain yet how it was missing after the copy process.

comment:12 by SF/mthreepwood, 11 years ago

@tdhs: Considering there was a segfault, I really hope we can consider this a crash.

comment:13 by digitall, 11 years ago

@mthreepwood: AH... I see your point i.e. E/ScummVM (25311): Groovie::Music: fat.ad not found! F/libc (25311): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 25324 (ScummVM)

The second shouldn't happen.. It should error, but then exit cleanly.

scott_t: Maybe try removing that file on a desktop build, and then seeing if you can replicate this error out and segfault crash and then see why it is happening...

comment:14 by digitall, 11 years ago

If I have time, I will try that with Valgrind...

comment:15 by digitall, 11 years ago

Right... No replication of the segfault and no critical warnings from valgrind running on Linux x86_64 with latest Git master, with a set of T7G datafiles with fat.ad removed.

However, the error call does cause a number of minor leaks, which could be provoking this by OOM? These are mainly from MidiDriver_ADLIB::open() and the T7G font loading:

==19778== 7,248 bytes in 1 blocks are possibly lost in loss record 805 of 849 ==19778== at 0x4C2A462: calloc (vg_replace_malloc.c:593) ==19778== by 0x536240: OPL::MAME::OPLCreate(int, int, int) (mame.cpp:1118) ==19778== by 0x536659: OPL::MAME::makeAdLibOPL(int) (mame.cpp:1243) ==19778== by 0x534511: OPL::MAME::OPL::init(int) (mame.cpp:56) ==19778== by 0x52EF20: MidiDriver_ADLIB::open() (adlib.cpp:1436) ==19778== by 0x41C907: Groovie::MusicPlayerXMI::MusicPlayerXMI(Groovie::Groov ieEngine*, Common::String const&) (music.cpp:390) ==19778== by 0x41A9B3: Groovie::GroovieEngine::run() (groovie.cpp:178) ==19778== by 0x409460: runGame(PluginSubclass<MetaEngine> const*, OSystem&, Common::String const&) (main.cpp:229) ==19778== by 0x40A456: scummvm_main (main.cpp:474) ==19778== by 0x4080D7: main (posix-main.cpp:45) ==19778== ==19778== 7,256 bytes in 1 blocks are possibly lost in loss record 806 of 849 ==19778== at 0x4C2C037: operator new(unsigned long) (vg_replace_malloc.c:298) ==19778== by 0x53180B: AdLibEmuMusicPlugin::createInstance(MidiDriver**, unsigned int) const (adlib.cpp:2302) ==19778== by 0x517AA1: MidiDriver::createMidi(unsigned int) (mididrv.cpp:371) ==19778== by 0x41C8AE: Groovie::MusicPlayerXMI::MusicPlayerXMI(Groovie::GroovieEngine*, Common::String const&) (music.cpp:387) ==19778== by 0x41A9B3: Groovie::GroovieEngine::run() (groovie.cpp:178) ==19778== by 0x409460: runGame(PluginSubclass<MetaEngine> const*, OSystem&, Common::String const&) (main.cpp:229) ==19778== by 0x40A456: scummvm_main (main.cpp:474) ==19778== by 0x4080D7: main (posix-main.cpp:45)

==19778== 10,799 bytes in 37 blocks are possibly lost in loss record 821 of 849 ==19778== at 0x4C2B8C7: operator new[](unsigned long) (vg_replace_malloc.c:363) ==19778== by 0x4337B8: Groovie::T7GFont::load(Common::SeekableReadStream&) (font.cpp:101) ==19778== by 0x41A5DB: Groovie::GroovieEngine::run() (groovie.cpp:142) ==19778== by 0x409460: runGame(PluginSubclass<MetaEngine> const*, OSystem&, Common::String const&) (main.cpp:229) ==19778== by 0x40A456: scummvm_main (main.cpp:474) ==19778== by 0x4080D7: main (posix-main.cpp:45)

comment:16 by scott-t, 11 years ago

I'm beginning to suspect the segfault an Android backend issue relating to the error() call. Out of curiosity I tried BASS and had similar outcome if I omitted sky.dnr:

E/ScummVM (24295): Could not open sky.dnr! F/libc (24295): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 24308 (ScummVM)

As for memory leaks, wouldn't all engines do that if they hit an error() ?

comment:17 by digitall, 11 years ago

Owner: changed from scott-t to fuzzie

comment:18 by digitall, 11 years ago

scott_t: I concur with your conclusion that this is an issue with the Android backend dealing with error() calls.

Reassigning to Android maintainer...

clone2727: Do you concur?

comment:19 by csnover, 6 years ago

Component: Engine: GrooviePorts
Game: 7th Guest
Summary: GROOVIE: T7G on Android crashesANDROID: Error handling ends in segfault

comment:20 by digitall, 6 years ago

Component: PortsPort: Android

comment:21 by antoniou79, 5 years ago

I've tested today with the plain (non-SDL) Android port (local build ScummVM 2.2.0git (targeting armeabi-v7a only) on three different devices

  • a Huawei, Android 4.4.4
  • a Moto E, Android 5.1
  • and a Xperia Z5 Compact, Android 7.1

I also tested with today's stable build from the ScummVM buildbot for Android (ARM64) (ScummVM 2.1.0pre11-gf4638bbfc3 (Sep 25 2019 06:43:41)) on:

  • the Xperia Z5 Compact, Android 7.1 device.

The test case was not with the t7g game but with Beneath a Steel Sky CD version (downloadable from ScummVM Games web page), since scott-t mentioned that the issue could be reproduced using that game (and in fact should be independent of the game engine).

The BASS game runs ok and exits ok if it has all of its required data files on all three devices.
By removing a required data file (eg sky.dnr) the app will exit to "desktop" but without a seg fault, again on all three devices.

logcat indicates:
E/ScummVM: Could not open sky.dnr!

No follow up message about a segmentation fault / SIGSEGV or similar, and there's no error popup on the devices.

There's also no popup informative message on the devices about why ScummVM just exited upon loading the game, but that is beyond the scope of this bug ticket.

I am unsure as of yet if this got fixed by my recent commits or earlier ones.
For reference these are my recent commits:
https://github.com/scummvm/scummvm/commit/d39eca7e39f322b378845aba9ce7c09bc477987d
https://github.com/scummvm/scummvm/commit/b4b9ad1743dcf97999b7fda4860aa964d119118c
https://github.com/scummvm/scummvm/commit/f79d5d9b6baa3e002c93df22d29eac62de3e618f

The commits are backported to 2.1 branch.

I would prefer if someone also tested on their devices, preferably with the v8a 64 bit build, since it has happened before that the android app would not crash on any of my devices but it would crash for someone else!

comment:22 by raziel-, 4 years ago

Summary: ANDROID: Error handling ends in segfaultBACKENDS: Android - Error handling ends in segfault

comment:23 by antoniou79, 4 years ago

Owner: changed from fuzzie to antoniou79
Resolution: fixed
Status: newclosed

Tested with The 7th Guest (GOG version files) today on my Android 7.1.1 Xperia Z5 Compact device., with ScummVM 2.2.1pre

No issues.

Since the ticket is very old, not reproducible (by me anyway) and we got no further feedback since my last response here about commits that possibly fixed the issue, I am closing the ticket as fixed.

Note: See TracTickets for help on using tickets.