Opened 12 years ago

Closed 12 years ago

#3881 closed defect (fixed)

IHNM: Occasional crashes on exit

Reported by: eriktorbjorn Owned by: eriktorbjorn
Priority: normal Component: Engine: SAGA
Keywords: Cc:
Game: I Have No Mouth

Description

Latest 0.12 SVN English version of the game

A few times while testing IHNM, ScummVM crashed for me on exit. Glibc would complain about freeing an invalid pointer, or something like that. I suppose it could be memory corruption, or the engine's destructor is freeing some pointer that's no longer valid. Maybe.

Ticket imported from: #2058408. Ticket imported from: bugs/3881.

Change History (7)

comment:1 by bluegr, 12 years ago

Unfortunately, this is not very helpful at all. I'm not sure what could be causing this, and the fact that it doesn't occur all the time leads me to believe it's some sort of memory corruption. Can you remember the chapter that you were in, before exiting? Does Valgrind show anything suspicious?

comment:2 by eriktorbjorn, 12 years ago

I played through Gorrister's, Ellen's and Benny's chapters yesterday, so it would have to be one of them.

I haven't managed to catch anything in Valgrind. I've made a complete recompile of ScummVM, just in case. I'll have to wait and see if it happens again.

comment:3 by eriktorbjorn, 12 years ago

I did manage to catch one Valgrind warning on exit (I exited by closing the ScummVM window, rather than using the in-game GUI, if that makes any difference):

==2644== Invalid free() / delete / delete[] ==2644== at 0x4022B8A: free (vg_replace_malloc.c:323) ==2644== by 0x418B1EA: snd_seq_close (in /usr/lib/libasound.so.2.0.0) ==2644== by 0x86197FC: MidiDriver_ALSA::close() (alsa.cpp:140) ==2644== by 0x84A6280: Saga::MusicPlayer::close() (music.cpp:275) ==2644== by 0x84A637E: Saga::MusicPlayer::~MusicPlayer() (music.cpp:241) ==2644== by 0x84A6047: Saga::Music::~Music() (music.cpp:367) ==2644== by 0x84905B9: Saga::SagaEngine::~SagaEngine() (saga.cpp:135) ==2644== by 0x8053DD5: _ZL7runGamePK14PluginSubclassI10MetaEngineER7OSystemRKN6Common6StringE (main.cpp:226) ==2644== by 0x80546CD: scummvm_main (main.cpp:313) ==2644== by 0x8051741: main (main.cpp:108) ==2644== Address 0xfd000007 is not stack'd, malloc'd or (recently) free'd

But I don't know if that would have led to a crash if I hadn't used Valgrind.

This time, I started ScummVM with the -x command-line option, and that led to a number of Valgrind warnings, also seemingly related to the MIDI player:

==2644== Invalid write of size 4 ==2644== at 0x418AA0B: snd_seq_event_output_buffer (in /usr/lib/libasound.so.2.0.0) ==2644== by 0x418AABB: snd_seq_event_output (in /usr/lib/libasound.so.2.0.0) ==2644== by 0x86191DD: MidiDriver_ALSA::send_event(int) (alsa.cpp:237) ==2644== by 0x86194ED: MidiDriver_ALSA::send(unsigned) (alsa.cpp:159) ==2644== by 0x85EE3F6: MidiChannel_MPU401::send(unsigned) (mpu401.cpp:47) ==2644== by 0x84A59E9: Saga::MusicPlayer::send(unsigned) (music.cpp:306) ==2644== by 0x8130DE1: MidiDriver::send(unsigned char, unsigned char, unsigned char) (mididrv.h:190) ==2644== by 0x85E99C6: MidiParser::onTimer() (midiparser.cpp:171) ==2644== by 0x84A62CF: Saga::MusicPlayer::onTimer(void*) (music.cpp:332) ==2644== by 0x861DFF2: DefaultTimerManager::handler() (default-timer.cpp:109) ==2644== by 0x805327B: _ZL13timer_handlerjPv (sdl.cpp:56) ==2644== by 0x42A054C: (within /usr/lib/libSDL-1.2.so.0.11.1) ==2644== Address 0x6be9aa0 is 0 bytes after a block of size 72 alloc'd ==2644== at 0x4021E22: calloc (vg_replace_malloc.c:397) ==2644== by 0x41855F7: snd_seq_hw_open (in /usr/lib/libasound.so.2.0.0) ==2644== by 0x4185946: _snd_seq_hw_open (in /usr/lib/libasound.so.2.0.0) ==2644== by 0x418B50C: (within /usr/lib/libasound.so.2.0.0) ==2644== by 0x8619927: MidiDriver_ALSA::open() (alsa.cpp:102) ==2644== by 0x84A57D8: Saga::MusicPlayer::open() (music.cpp:264) ==2644== by 0x84A6622: Saga::MusicPlayer::MusicPlayer(MidiDriver*) (music.cpp:235) ==2644== by 0x84A6682: Saga::Music::Music(Saga::SagaEngine*, Audio::Mixer*, MidiDriver*, int) (music.cpp:350) ==2644== by 0x848FFF5: Saga::SagaEngine::init() (saga.cpp:197) ==2644== by 0x8053D78: _ZL7runGamePK14PluginSubclassI10MetaEngineER7OSystemRKN6Common6StringE (main.cpp:210) ==2644== by 0x80546CD: scummvm_main (main.cpp:313) ==2644== by 0x8051741: main (main.cpp:108)

There were several other warnings, but they all looked similar to me. I'm not quite sure how to interpret it, though. Could it have been trying to do things with the music player before it had been properly initialised?

comment:4 by eriktorbjorn, 12 years ago

It may be just wishful thinking, but I haven't been able to reproduce the crash since I added the mutex lock.

comment:5 by bluegr, 12 years ago

This seems to be caused by the same issue as bug #2057216

Since you haven't been able to reproduce this with the mutex lock, I'm tempted to lower the priority of these two bugs to 1, or close them altogether

comment:6 by bluegr, 12 years ago

Owner: set to eriktorbjorn
Resolution: fixed
Status: newclosed

comment:7 by bluegr, 12 years ago

I'll close this for now, as it seems to be fixed

Note: See TracTickets for help on using tickets.