-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
This seems potentially related to #31
In a project I use, easymidi.getInputs is called once every second (this probably isn't ideal, but that's a discussion for another day)
After around a minute, this loop starts spewing the following error:
ALSA lib seq_hw.c:540:(snd_seq_hw_open) open /dev/snd/seq failed: Cannot allocate memory
MidiInAlsa::initialize: error creating ALSA sequencer client object.
[2025-07-20 11:01:46.0453] - error: Error: Failed to initialise RtMidi
at new Input (/home/dennisr/.config/Firebot/v5/profiles/Main/scripts/firebot-midi/script.js:547:18)
at getInputs (/home/dennisr/.config/Firebot/v5/profiles/Main/scripts/firebot-midi/script.js:991:17)
at Timeout._onTimeout (/home/dennisr/.config/Firebot/v5/profiles/Main/scripts/firebot-midi/script.js:1858:53)
at listOnTimeout (node:internal/timers:581:17)
at process.processTimers (node:internal/timers:519:7) uncaughtException
it appears that input.closePort() here doesn't properly close the port. In testing a minimal example (code below), the loop would crash when i == 61. I tried adding input.destroy() below input.closePort() (in library code) which fixed this issue and allowed the loop to continue to i == 119, which is the limit I set for my test case.
import { getInputs } from "easymidi";
for (let i = 0; i < 120; i++) {
console.log(getInputs());
console.log(i);
}Metadata
Metadata
Assignees
Labels
No labels