[alsa-devel] fixing seq_midi: MIDI output buffer overrun

Adam Goode agoode at chromium.org
Mon Dec 24 21:43:58 CET 2018


Hi,

I am investigating why Chromium can't reliably send sysex messages on
Linux. (See https://bugs.chromium.org/p/chromium/issues/detail?id=917708.)

I've seen the message at
https://alsa-devel.alsa-project.narkive.com/6w35hffF/sysex-overflow-when-using-the-midi-sequencer-event-interface

Chromium does use seq and we do need sysex to be reliable since
vendors such as Novation and Yamaha use Web MIDI to interface with
hardware.

The code in question predates git history (2005). It's
event_process_midi() and dump_midi() in seq_midi.c.

I see that dump_midi() returns either ENOMEM or EINVAL under certain
conditions, but the only caller (event_process_midi()) throws these
errors away and always returns 0 if everything but dump_midi()
succeeds.

A few questions:

1. Can I change dump_midi to block instead of return ENOMEM if I don't
use SND_SEQ_NONBLOCK in snd_seq_open?

2. What should be returned in NONBLOCK mode? Probably EAGAIN?

3. The general blocking behavior of seq seems inconsistent. If I am
using snd_seq_ev_set_direct, then I get EAGAIN even with a blocking
open. Should I expect blocking from the pool, or only if using a
queue?

4. Is there any obvious fix I am overlooking?


Thanks,

Adam


More information about the Alsa-devel mailing list