missionpinball / mpf-mc

The Mission Pinball Framework Media Controller. Controls graphics, sounds, DMDs, and LCD displays in MPF.
http://missionpinball.org
MIT License
21 stars 42 forks source link

Crash in audio library #193

Closed qcapen closed 8 years ago

qcapen commented 8 years ago

From Mark Incitti on Slack:

crash in audio - this has happened in random(?) places, 3 times in about 20 runs.

Log file:

2016-09-25 23:58:46,318 : INFO : kivy : Factory: 179 symbols loaded 2016-09-25 23:58:47,843 : INFO : kivy : Image: Providers: img_tex, img_dds, img_gif, img_sdl2 (img_pil, img_ffpyplayer ignored) 2016-09-25 23:58:49,531 : INFO : kivy : VideoGstplayer: Using Gstreamer 1.4.5.0 2016-09-25 23:58:49,532 : INFO : kivy : Video: Provider: gstplayer 2016-09-25 23:58:49,778 : INFO : kivy : Loading MPF-MC controller 2016-09-25 23:58:49,778 : INFO : mpfmc : Mission Pinball Framework Media Controller v0.31.6 2016-09-25 23:58:49,779 : INFO : mpfmc : Machine path: C:\nbx 2016-09-25 23:58:49,779 : INFO : mpfmc : Starting clock at 30.0Hz 2016-09-25 23:58:50,569 : INFO : kivy : Text: Provider: sdl2 2016-09-25 23:58:51,129 : INFO : kivy : OSC: using <thread> for socket 2016-09-25 23:58:51,136 : INFO : kivy : Window: Provider: sdl2 2016-09-25 23:58:52,982 : INFO : kivy : GL: GLEW initialization succeeded 2016-09-25 23:58:52,982 : INFO : kivy : GL: OpenGL version <b'3.3.11672 Compatibility Profile Context'> 2016-09-25 23:58:52,982 : INFO : kivy : GL: OpenGL vendor <b'ATI Technologies Inc.'> 2016-09-25 23:58:52,982 : INFO : kivy : GL: OpenGL renderer <b'ATI Radeon HD 3400 Series'> 2016-09-25 23:58:52,983 : INFO : kivy : GL: OpenGL parsed version: 3, 3 2016-09-25 23:58:52,983 : INFO : kivy : GL: Shading version <b'3.30'> 2016-09-25 23:58:52,983 : INFO : kivy : GL: Texture max size <8192> 2016-09-25 23:58:52,983 : INFO : kivy : GL: Texture max units <16> 2016-09-25 23:58:53,050 : INFO : kivy : Shader: fragment shader: <b'Fragment shader was successfully compiled to run on hardware.'> 2016-09-25 23:58:53,099 : INFO : kivy : Shader: vertex shader: <b'Vertex shader was successfully compiled to run on hardware.'> 2016-09-25 23:58:53,149 : INFO : kivy : Shader: program: <Vertex shader(s) linked, fragment shader(s) linked.> 2016-09-25 23:58:53,152 : INFO : kivy : Window: auto add sdl2 input provider 2016-09-25 23:58:53,152 : INFO : kivy : Window: virtual keyboard not allowed, single mode, not docked 2016-09-25 23:58:54,563 : INFO : AudioInterface : Initialized 0.31.0.dev17 2016-09-25 23:58:54,817 : INFO : kivy : Base: Start application main loop 2016-09-25 23:58:54,972 : INFO : kivy : Shader: program: <Vertex shader(s) linked, fragment shader(s) linked.> 2016-09-25 23:58:54,980 : INFO : kivy : Shader: program: <Vertex shader(s) linked, fragment shader(s) linked.> 2016-09-25 23:58:54,981 : INFO : kivy : GL: NPOT texture support is available 2016-09-25 23:58:54,992 : INFO : kivy : Shader: program: <Vertex shader(s) linked, fragment shader(s) linked.> 2016-09-25 23:58:54,996 : INFO : kivy : Shader: fragment shader: <b'Fragment shader was successfully compiled to run on hardware.'> 2016-09-25 23:58:55,009 : INFO : kivy : Shader: program: <Vertex shader(s) linked, fragment shader(s) linked.> 2016-09-25 23:58:55,124 : INFO : kivy : Shader: program: <Vertex shader(s) linked, fragment shader(s) linked.> 2016-09-25 23:58:55,132 : INFO : kivy : Shader: program: <Vertex shader(s) linked, fragment shader(s) linked.> 2016-09-25 23:58:55,140 : INFO : kivy : Shader: program: <Vertex shader(s) linked, fragment shader(s) linked.> 2016-09-25 23:58:55,143 : INFO : kivy : Shader: fragment shader: <b'Fragment shader was successfully compiled to run on hardware.'> 2016-09-25 23:58:55,153 : INFO : kivy : Shader: program: <Vertex shader(s) linked, fragment shader(s) linked.> 2016-09-25 23:59:16,541 : INFO : MPF-MC BCP Server : Starting up on localhost port 5050 2016-09-25 23:59:16,548 : INFO : MPF-MC BCP Server : Waiting for a connection... 2016-09-25 23:59:16,731 : INFO : MPF-MC BCP Server : Received connection from: 127.0.0.1:53890 2016-09-25 23:59:22,727 : INFO : kivy : GL: Unpack subimage support is available 2016-09-26 00:03:49,057 : WARNING : Track.0.TrackStandard.sfx : Received a notification message for a sound instance (id: 222467520) that is no longer managed in the audio library. Notification will be discarded. 2016-09-26 00:03:49,058 : WARNING : Track.0.TrackStandard.sfx : Received a notification message for a sound instance (id: 222467520) that is no longer managed in the audio library. Notification will be discarded. 2016-09-26 00:13:22,803 : INFO : kivy : Base: Leaving application in progress... 2016-09-26 00:13:22,804 : ERROR : kivy : unorderable types: NoneType() < SoundInstance() Traceback (most recent call last): File "c:\python34\lib\site-packages\mpfmc\commands\mc.py", line 153, in __init__ thread_stopper=thread_stopper).run() File "c:\python34\lib\site-packages\kivy\app.py", line 828, in run runTouchApp() File "c:\python34\lib\site-packages\kivy\base.py", line 487, in runTouchApp EventLoop.window.mainloop() File "c:\python34\lib\site-packages\kivy\core\window\window_sdl2.py", line 619, in mainloop self._mainloop() File "c:\python34\lib\site-packages\kivy\core\window\window_sdl2.py", line 362, in _mainloop EventLoop.idle() File "c:\python34\lib\site-packages\kivy\base.py", line 327, in idle Clock.tick() File "c:\python34\lib\site-packages\kivy\clock.py", line 515, in tick self._process_events() File "c:\python34\lib\site-packages\kivy\clock.py", line 647, in _process_events event.tick(self._last_tick, remove) File "c:\python34\lib\site-packages\kivy\clock.py", line 406, in tick ret = callback(self._dt) File "c:\python34\lib\site-packages\mpfmc\core\audio\__init__.py", line 221, in tick self.audio_interface.process() File "Pinball\mpf_mc\mpfmc\core\audio\audio_interface.pyx", line 638, in Pinball.mpf_mc.mpfmc.core.audio.audio_interface.AudioInterface.process (mpfmc/core/audio/audio_interface.c:9819) File "Pinball\mpf_mc\mpfmc\core\audio\audio_interface.pyx", line 1871, in Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard.process (mpfmc/core/audio/audio_interface.c:17799) File "Pinball\mpf_mc\mpfmc\core\audio\audio_interface.pyx", line 1971, in Pinball.mpf_mc.mpfmc.core.audio.audio_interface.TrackStandard._get_next_sound (mpfmc/core/audio/audio_interface.c:18903) File "c:\python34\lib\queue.py", line 195, in get_nowait return self.get(block=False) File "c:\python34\lib\queue.py", line 177, in get item = self._get() File "c:\python34\lib\queue.py", line 233, in _get return heappop(self.queue) TypeError: unorderable types: NoneType() < SoundInstance() 2016-09-26 00:13:22,861 : INFO : kivy : Stopping child threads... (3 remaining) 2016-09-26 00:13:23,050 : INFO : mpfmc : Stopping... 2016-09-26 00:13:23,070 : INFO : mpfmc : Loop rate 32.37 Hz 2016-09-26 00:13:23,111 : INFO : MPF-MC BCP Server : Stopping BCP sending thread 2016-09-26 00:13:23,370 : INFO : kivy : All child threads stopped.

qcapen commented 8 years ago

This crash was caused when more than one sound is stopped that is still in the queue. The queue entry is left in the queue (so the heap structure does not get corrupted) and the sound instance object in the entry is set to None. This lead to priority queue sorting problems as there could then be several entries that have the same sort priority and the None value could not be used to break a tie. A queue entry count/id was added to ensure that every queue entry has a unique identifier to use to break ties when sorting.

qcapen commented 8 years ago

Fix included in 0.31.7 (PR #195)