<p></p>
<p>I get a 100% reliable freeze in the music import browser, while switching away from testfiles/gurgu.mid on Linux; both with SDL_Mixer 2.0.4 on 64-bit Linux and SDL_mixer 2.0.3 on 32-bit Linux, but not when using music_sdl. This looks like a bug in SDL_Mixer's backend for playing MIDI with Timidity.</p>
<pre><code>(gdb) info threads
  Id   Target Id                                       Frame 
* 1    Thread 0xf7f4f7c0 (LWP 32432) "ohrrpgce-custom" 0xf7f3b8e8 in __lll_lock_wait () from /lib/libpthread.so.0
  2    Thread 0xf28ffb40 (LWP 32433) "ohrrpgce-:rcs0"  0xf7f36d5b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
  3    Thread 0xf1db7b40 (LWP 32434) "ohrrpgc:disk$0"  0xf7f36d5b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
  4    Thread 0xf15b6b40 (LWP 32435) "ohrrpgc:disk$1"  0xf7f36d5b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
  5    Thread 0xf0db5b40 (LWP 32436) "ohrrpgc:disk$2"  0xf7f36d5b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
  6    Thread 0xf05b4b40 (LWP 32437) "ohrrpgc:disk$3"  0xf7f36d5b in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
  7    Thread 0xf7217b40 (LWP 32440) "PulseHotplug"    0xf77b188f in ppoll () from /lib/libc.so.6
  8    Thread 0xcf4ffb40 (LWP 32441) "SDLAudioP2"      0xf7d5adf3 in Timidity_Start () from /usr/lib/libSDL2_mixer-2.0.so.0
(gdb) bt
#0  0xf7f3b8e8 in __lll_lock_wait () from /lib/libpthread.so.0
#1  0xf7f32459 in pthread_mutex_lock () from /lib/libpthread.so.0
#2  0xf7e5dccf in ?? () from /usr/lib/libSDL2-2.0.so.0
#3  0xf7d85636 in ?? () from /usr/lib/libSDL2-2.0.so.0
#4  0xf7d52812 in Mix_LockAudio () from /usr/lib/libSDL2_mixer-2.0.so.0
#5  0xf7d539c5 in Mix_FreeMusic () from /usr/lib/libSDL2_mixer-2.0.so.0
#6  0x0832b4f3 in MUSIC_STOP () at /mnt/common/ohrrpgce/spare-git/music_sdl.bas:444
#7  0x083c01c1 in MUSICPREVIEWER::UNLOAD_PREVIEW (THIS=...) at browse.bas:435
#8  0x083c0a83 in BROWSE_HOVER (TREE=..., BR=...) at browse.bas:514
...
(gdb) thread 7
[Switching to thread 7 (Thread 0xf7217b40 (LWP 32440))]
#0  0xf77b188f in ppoll () from /lib/libc.so.6
(gdb) bt
#0  0xf77b188f in ppoll () from /lib/libc.so.6
#1  0xefd5300b in pa_mainloop_poll () from /usr/lib/libpulse.so.0
#2  0xefd53799 in pa_mainloop_iterate () from /usr/lib/libpulse.so.0
#3  0xefd53875 in pa_mainloop_run () from /usr/lib/libpulse.so.0
#4  0xf7e40d9c in ?? () from /usr/lib/libSDL2-2.0.so.0
#5  0xf7de861b in ?? () from /usr/lib/libSDL2-2.0.so.0
#6  0xf7e5d54b in ?? () from /usr/lib/libSDL2-2.0.so.0
#7  0xf7f2f517 in start_thread () from /lib/libpthread.so.0
#8  0xf77bd146 in clone () from /lib/libc.so.6
(gdb) thread 8
[Switching to thread 8 (Thread 0xcf4ffb40 (LWP 32441))]
#0  0xf7d5adf3 in Timidity_Start () from /usr/lib/libSDL2_mixer-2.0.so.0
(gdb) bt
#0  0xf7d5adf3 in Timidity_Start () from /usr/lib/libSDL2_mixer-2.0.so.0
#1  0xf7d57ad0 in TIMIDITY_GetSome () from /usr/lib/libSDL2_mixer-2.0.so.0
#2  0xf7d52d9a in music_pcm_getaudio () from /usr/lib/libSDL2_mixer-2.0.so.0
#3  0xf7d5799c in TIMIDITY_GetAudio () from /usr/lib/libSDL2_mixer-2.0.so.0
#4  0xf7d52ee8 in music_mixer () from /usr/lib/libSDL2_mixer-2.0.so.0
#5  0xf7d50ffa in mix_channels () from /usr/lib/libSDL2_mixer-2.0.so.0
#6  0xf7d844f6 in ?? () from /usr/lib/libSDL2-2.0.so.0
#7  0xf7de861b in ?? () from /usr/lib/libSDL2-2.0.so.0
#8  0xf7e5d54b in ?? () from /usr/lib/libSDL2-2.0.so.0
#9  0xf7f2f517 in start_thread () from /lib/libpthread.so.0
#10 0xf77bd146 in clone () from /lib/libc.so.6
</code></pre>
<p>Further poking around with gdb shows that <code>music_pcm_getaudio</code> on thread 8 is stuck in an infinite loop on this very short midi file (which IIRC has no notes):</p>
<pre><code>    while (len > 0 && !done) {
        int consumed = GetSome(context, dst, len, &done);
        if (consumed < 0) {
            break;
        }

        if (volume == MIX_MAX_VOLUME) {
            dst += consumed;
        } else {
            SDL_MixAudioFormat(snd, dst, music_spec.format, (Uint32)consumed, volume);
            snd += consumed;
        }
        len -= consumed;
    }
</code></pre>
<p>stepping through the function I found that <code>len = 8192</code>, <code>volume = MIX_MAX_VOLUME</code> but <code>consumed = 0</code>.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/ohrrpgce/ohrrpgce/issues/1196">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AMWGWZR5ZSSWAJXU33CR4STS354VFANCNFSM4WUPM66A">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AMWGWZTF2E3JNPWKH2YJDF3S354VFA5CNFSM4WUPM66KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4L26NR4Q.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/ohrrpgce/ohrrpgce/issues/1196",
"url": "https://github.com/ohrrpgce/ohrrpgce/issues/1196",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>