rtpmidid
rtpmidid copied to clipboard
crash in alsa after some time. archlinux
Hey, thank you for writing this software, i'm working on using it to forward MIDI to a raspberry pi which is hooked up to an LED strip.
Working great except for this crash that seems to happen after some time. Further attempts to restart the service just keep failing with this
Is this issue further upstream? Trying to understand where in the stack this might be failing. it works for some time perfectly fine, but eventually it fails
OS: Arch Linux x86_64 Kernel: 5.19.2-arch1-1
Aug 20 23:43:11 sreich-archlinux-desktop systemd[1]: Started rtpmidid. Aug 20 23:43:11 sreich-archlinux-desktop rtpmidid[35245]: [main.cpp:54] Real Time Protocol Music Instrument Digital Interface Dae> Aug 20 23:43:11 sreich-archlinux-desktop rtpmidid[35245]: [main.cpp:56] (C) 2019-2021 David Moreno Montero [email protected] Aug 20 23:43:11 sreich-archlinux-desktop rtpmidid[35245]: [alsa/seq_hw.c:466] open /dev/snd/seq failed: Cannot allocate memory Aug 20 23:43:11 sreich-archlinux-desktop rtpmidid[35245]: [main.cpp:68] Can't open sequencer. Maybe user has no permissions. Aug 20 23:43:11 sreich-archlinux-desktop systemd[1]: rtpmidid.service: Main process exited, code=exited, status=1/FAILURE Aug 20 23:43:11 sreich-archlinux-desktop systemd[1]: rtpmidid.service: Failed with result 'exit-code'. Aug 20 23:43:11 sreich-archlinux-desktop systemd[1]: rtpmidid.service: Scheduled restart job, restart counter is at 5. Aug 20 23:43:11 sreich-archlinux-desktop systemd[1]: Stopped rtpmidid. Aug 20 23:43:11 sreich-archlinux-desktop systemd[1]: rtpmidid.service: Start request repeated too quickly. Aug 20 23:43:11 sreich-archlinux-desktop systemd[1]: rtpmidid.service: Failed with result 'exit-code'. Aug 20 23:43:11 sreich-archlinux-desktop systemd[1]: Failed to start rtpmidid. lines 957-1000/1000 (END)
rtpmidid --version [2022-08-21T03:51:53Z] [main.cpp:54] Real Time Protocol Music Instrument Digital Interface Daemon - 21.11~9~geab5c [2022-08-21T03:51:53Z] [main.cpp:56] (C) 2019-2021 David Moreno Montero [email protected] [2022-08-21T03:51:53Z] [config.cpp:91] rtpmidid version 21.11~9~geab5c
pipewire --version pipewire Compiled with libpipewire 0.3.56 Linked with libpipewire 0.3.56
Further information here. I've got core dumps from rtpmidid directly. Brief stack as below. I can send the full core dump if you think that will help.
demangled bt. i don't have debug symbols for this, but that could be arranged if that would assist you:
(gdb) bt #0 0x000055d4e50dbc7d in rtpmidid::rtppeer::send_midi(rtpmidid::io_bytes_reader const&) () (gdb) bt #0 0x000055d4e50dbc7d in rtpmidid::rtppeer::send_midi(rtpmidid::io_bytes_reader const&) () #1 0x000055d4e50e3d5d in rtpmidid::rtpserver::send_midi_to_all_peers(rtpmidid::io_bytes_reader const&) () #2 0x000055d4e50b485e in ?? () #3 0x000055d4e50aac8a in rtpmidid::aseq::read_ready() () #4 0x000055d4e50f0a25 in rtpmidid::poller_t::wait(std::optional<std::chrono::duration<long, std::ratio<1l, 1000l> > >) () #5 0x000055d4e50a7967 in main ()
PID: 635 (rtpmidid) UID: 1001 (rtpmidid) GID: 996 (audio) Signal: 11 (SEGV) Timestamp: Thu 2022-08-25 23:27:41 EDT (33min ago) Command Line: /usr/bin/rtpmidid Executable: /usr/bin/rtpmidid Control Group: /system.slice/rtpmidid.service Unit: rtpmidid.service Slice: system.slice Boot ID: a32d989880c2440587538a9fc64ec16f Machine ID: eafc6593d3e6439aab524cf99393d6b0 Hostname: sreich-archlinux-desktop Storage: /var/lib/systemd/coredump/core.rtpmidid.1001.a32d989880c2440587538a9fc64ec16f.635.1661484461000000.zst (inaccessible) Message: Process 635 (rtpmidid) of user 1001 dumped core.
Module linux-vdso.so.1 with build-id 61152204e983efd573ef3627c2b3822ef43b4880 Module libnss_myhostname.so.2 with build-id e8fa9f4e03fb26e629726d8270fea44506b8857c Module libnss_resolve.so.2 with build-id f71b661d7c0be7fcb69172dc4f37adb3fc88d678 Module libnss_mymachines.so.2 with build-id 7f9beccf161d3217a0d604ae34033fea40a5419d Module libgpg-error.so.0 with build-id 4738b8a9478177c202cccd64e0eb65d3dea2bfae Module liblz4.so.1 with build-id e63600ab23b2f6997f42fac2fa56e1f02ce159a1 Module libzstd.so.1 with build-id ab54c2881f53ab314e134f3e08c76d504376dd5d Module liblzma.so.5 with build-id d08f5868cd5adcc6b7c53bf1725aac65bd4539cd Module libgcrypt.so.20 with build-id 8bf3cb884124273640de797a3e77d86c98434ea4 Module libcap.so.2 with build-id 1f87347b85b55db2f75a2ecea5cb45d846dc7093 Module libsystemd.so.0 with build-id a664cbc6b724392704b96360284c40664d8d4c99 Module libdl.so.2 with build-id 2b416df8fd62af5dc5e987b11d99a5d0f772b440 Module libdbus-1.so.3 with build-id 7f4b16b4b407cbae2d7118d6f99610e29a18a56a Module libpthread.so.0 with build-id b966d4b239433c89ca36c0938381e2d92cd47639 Module ld-linux-x86-64.so.2 with build-id 5492655bffbf172ed8a07f285f760ead38f09404 Module libm.so.6 with build-id efeea58692a42176201df89f034aa4295a77ce74 Module libc.so.6 with build-id 7d4293a9bbe1f068ab7ae807c2d9377395eb5b41 Module libgcc_s.so.1 with build-id 308aed8b7d7e38f5efa23f75c25601668c1fc009 Module libstdc++.so.6 with build-id e0dd3ec5b0a62b122b4141c956c0b33a4d719144 Module libavahi-client.so.3 with build-id 1858551543958190c653b565cf0eb64609ad908a Module libavahi-common.so.3 with build-id 80fda945459a3476ccd1050783dfd5f5c17c479a Module libasound.so.2 with build-id 037b70e73a363662ffa089fcb4370cecb6ca7bd8 Module libfmt.so.8 with build-id 79e7e0fd9a4811d455cc3c20f836a3584053c9b5 Module rtpmidid with build-id 849e20e276dd1d765a35cf520c29edbcb1a437ab Stack trace of thread 635: #0 0x000055d4e50dbc7d _ZN8rtpmidid7rtppeer9send_midiERKNS_15io_bytes_readerE (rtpmidid + 0x4fc7d) #1 0x000055d4e50e3d5d _ZN8rtpmidid9rtpserver22send_midi_to_all_peersERKNS_15io_bytes_readerE (rtpmidid + 0x57d5d) #2 0x000055d4e50b485e n/a (rtpmidid + 0x2885e) #3 0x000055d4e50aac8a _ZN8rtpmidid4aseq10read_readyEv (rtpmidid + 0x1ec8a) #4 0x000055d4e50f0a25 _ZN8rtpmidid8poller_t4waitESt8optionalINSt6chrono8durationIlSt5ratioILl1ELl1000EEEEE (rtpmidid + 0x64a25) #5 0x000055d4e50a7967 main (rtpmidid + 0x1b967) #6 0x00007f44a347d2d0 n/a (libc.so.6 + 0x232d0) #7 0x00007f44a347d38a __libc_start_main (libc.so.6 + 0x2338a) #8 0x000055d4e50a7b55 _start (rtpmidid + 0x1bb55) ELF object binary architecture: AMD x86-64
I think both errors are unrelated. The first looks like an alsa error:
Aug 20 23:43:11 sreich-archlinux-desktop rtpmidid[35245]: [alsa/seq_hw.c:466] open /dev/snd/seq failed: Cannot allocate memory
for which I have no idea what can it be.. maybe too low on memory on this computer?
For the second it totally looks like a bug, I will look into it, as for myself sometimes is also restarting, and I'm not sure why... so it can be related.
According to my research, the "memory" issue is actually I believe This is because of resource exhaustion. I was looking around and I saw some other libraries and basically if they use an audio device and they create them. Alsa has a limit on how many can be created. After which you will receive this error
So essentially it is just a bad case of resource deallocation not happening. I don't know if it is RTPmidid or another application that I've used. I'm kind of waiting, because the problem is not consistent to reproduce
Not a case of out of memory (I had 20gb free at the time).
If you Google the error from it you can see other libraries which run into the issue like a nodejs midi one. Coincidentally that is one of the other applications that I was using at the time. So I am basically torn between pointing at this application or yours
And who knows, maybe they are two separate issues. Or maybe they're all the same and they're all coming from one. We shall see, I'll keep ya posted as things develop
If you can from time to time list all alsa sequencer ports, maybe its a problem of reserving too many (aconnect -l
) and this should point the culprit.