#10 Fix for ALSA system lockup


This is a fix for the bug described in

The bug can cause the entire computer to lock up when
Zyn is built with ALSA MIDI but started on a system
that doesn't have snd-seq loaded (and has blocked the
automatic loading of it by e.g. adding the line
'install snd-seq /bin/true' to /etc/modprobe.conf).

The patch adds two lines of code and two lines of
comment. One of the code lines is in the function
ALSAMidiIn::getmidicmd(). When the ALSA MIDI input has
been created successfully, this function calls the
blocking function snd_seq_event_input() to get next
MIDI event. ALSAMidiIn::getmidicmd() is called in a
non-blocking loop running in a realtime scheduled
thread, so this is the only time when other non-RT
threads get a chance to run. However, when the ALSA
MIDI input has _not_ been created successfully, this
function will just return and the thread will never
ever let non-RT threads run. This patch adds a call to
sleep() to fix that. It is only called when the ALSA
MIDI input already is broken, so it does not affect the
timing for a working input.

Also, the destructor of ALSAMidiIn tries to call
snd_seq_close() for the MIDI input, regardless of
whether it was created successfully or not. When it
isn't, that will lead to a crash. This patch adds a
check so it only calls snd_seq_close() if it actually
has something to close.


  • larsl

    larsl - 2006-11-06
  • larsl

    larsl - 2006-11-06
    • priority: 5 --> 9
  • Mark McCurry

    Mark McCurry - 2009-02-28

    It appears that this patch was applied a while ago (see changelog on CVS)

  • Mark McCurry

    Mark McCurry - 2009-02-28
    • status: open --> closed-accepted

Log in to post a comment.