-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After some time, ALSA fails with cannot allocate memory #6
Comments
@sreich no "ah-ah" moment sorry. Cannot allocate memory on windows is the classical error when a software tries to connect to a device that is already being used. But according to the logs you provided, it seems that something is wrong. My first thought is that when a client is connected, it is created in ALSA, and when it is disconnected in rtpmidid, the associated MIDI device is removed from ALSA. I'll try to reproduce it with rtpmidid, see if i can understand why there is this "MidiOutAlsa::initialize: error creating ALSA sequencer client object.". |
Okay thank you I would wait if I were you, I should know in a few days if it's rtpmidid or midi-jar, then I'll update you and we can go from there. Could be rtpmidid not freeing properly and that breaking any app which happens to include yours Thanks! |
@ArTiSTiX i am fairly confident it is midi-jar causing this issue somehow. i don't know if it is a combination of it and rtpmidid. But, basically I started midi-jar last night after my rtpmidid and piano led visualizer working just fine for weeks. but now it's giving me that out of memory error, because of resource exhaustion, after having your app run overnight i wish i had more information to help you, but idk where to proceed from here with this |
@sreich Huh. I'm very sorry that midi-jar is causing an issue with ALSA, and may be conflicting with rtpmidid. A few general questions though:
And a few environment variables i would need:
I can't promise you to find a solution, particularly if it's the node-midi implementation midi jar depend on that is faulty, but i can investigate this issue and try to reproduce it. I hope you will still be able to use midi jar on some occasions, maybe letting it always run is not possible with your issue, but i don't recall if MIDI devices are exclusive on ALSA, so maybe running MIDI jar only when you play would fit your needs, without using routing (other than for chord-display). |
yeah, midi devices are not exclusive on linux, that's a windows limitation with their midi driver. here's the thing, i'm not actually using routing in midi-jar, i don't need it because pipewire already does that, to be honest. i don't know if that helps narrow anything down i'm at a weird spot with it, i haven't had issues in weeks with midi-jar not running. i wish i were more help here in trying to track it down sounds like guys who know more than me have tracked it down to node-midi, perhaps start with investigating this: colinbdclark/flocking-midi-router#4 there is a fork of node-midi he has that works around it. perhaps we can start there? depending on its complexity, it might be easier for you to switch to that, make me a build and i will run it overnight then we will know |
@sreich thanks for the resources, i might try something. First solution could be to add a setting to disable polling the midi device every 100ms (my only solution since RtMidi does not provide observability on connect/disconnect) - and have a longer delay could maybe help a bit. Thus you will need to manually refresh devices after a midi connect/disconnect device you use. I'll try to reproduce the issue mentioned here. Thanks for the investigation ! |
@sreich I'm sorry for the long delay for sorting this issue out. For what it seems, when opening a port with RtMidi, it automatically creates an additional virtual port. For some reason, when closing the port, the resource is not immediately released, so this might be the issue here. When letting more delay for the garbage collector to free those resources, some ports are removed (and it raises a new kind of issue). Currently, MIDI Jar closes and opens new ports each time there is a different port count detected. Works fine on Windows & MacOS CoreAudio, but can be an issue with ALSA (each connection triggers a new refresh, which can at some point, lead to some feedback refresh loop). Now i would have to rewrite the entire logic to avoid closing ports that did not change, ignore those internal ports, and I might have to create a better abstraction for MIDI Devices. Sorry again for taking my time on the subject. |
Yeah I was afraid it would be tricky to fix, at least you have a better understanding of it and can reproduce, that's good news! No problem. I'm sure it isn't the most exciting of things to work on, but I am looking forward to being able to use this software when this is fixed |
FYI, this does not affect me now. Basically I bypassed RTP MIDI. I don't run it on my computer anymore, I bought a hardware solution that multiplexes MIDI. And that seems to work fine. It's basically a dongle that I connect to my raspberry pi and then the USB from that goes out into my computer to complete the second connection that I need So, not as high priority given it's able to work just fine. Now that I have the solution. You can feel free to reprioritize as you choose, there's another bug on filing now that affects me more ;) |
Ok i see. Since linux was unfortunately not on my prio list, i am not planning to rewrite this right now (but this might be useful at some point for future features). Just out of curiosity, what do you use the Raspberry PI for ? This is the kind of features i would like to explore in the future of MIDI Jar (interactions with Philips Hue & Nanoleaf maybe) and i am wondering if you are using other open source projects to interact with a raspberry for such usecases. |
Yep I understand Precisely, I have a light strip hooked up to my piano. I use this project for it, it works really well. Lots of customization for the strip https://github.com/onlaj/Piano-LED-Visualizer So I have that running on my pi. I haven't used it for the learning feature, only the lights. I'd like to get the actual light strip setup to look more pro. Right now it's just a plain strip and tape haha. Such is the way I am, polishing the projects is not my forte lol. Just ask if you've got further questions on it |
I'm currently tracing a system crash periodically that...as I dig more into this, I am becoming more suspect it is this app/node-midi, in particular
I'm currently connecting my raspberry pi as a client to this desktop machine's server of rtpmidid. It could very well be rtpmidid, but more digging on the error pointed me towards this issue below
Log issue I receive is:
when I run
aconnect -l
I get thisMy system gets into a state of this, looks like it is resource locked until I reboot. Mind you, this is now for all clients. But I think it might be a resource leak caused by midi-jar which of course causes issues for everyone.
justinlatimer/node-midi#118
Mind you these are just bits of info I've been scavenging, i'm trying to trace it through my system. Do you happen to know if the architecture could cause something like this, and the node-midi that you are using? I don't want to waste your time if it is not this software, but perhaps you will have a "ah-ha!" moment by me asking this
I will further investigate(gotta wait for it to reproduce itself) to see if I can blame it on the other MIDI client software that I am using (rtpmidid). But for now it is pointing this way. I will keep you updated.
The text was updated successfully, but these errors were encountered: