<div dir="ltr"><div>Hi, <br>I have observed some lockups with qmi-proxy and I think I narrowed down the issue.<br><br>Replicatable setup:<br>1. Start an instance of qmi-proxy.<br>2. Run multiple concurrent qmicli commands with -p for example:<br>   "qmicli -p -d /dev/cdc-wdm0 --device-open-version-info --dms-noop & qmicli -p -d /dev/cdc-wdm0 --device-open-version-info --dms-noop & qmicli -p -d /dev/cdc-wdm0 --device-open-version-info --dms-noop"<br>The following or similar error should appear:<br>   "error: couldn't create client for the 'dms' service: CID allocation failed in the CTL client: Transaction timed out"<br>If the error does not appear kill the running qmi-proxy and repeat the steps.<br><br>Probable cause:<br>There is a race condition that allows the same qmi-devices to be open multiple times if proxy requests are made in quick succession.<br>This race condition is known and handled:<br><a href="https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/blob/main/src/libqmi-glib/qmi-proxy.c#L371">https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/blob/main/src/libqmi-glib/qmi-proxy.c#L371</a><br><br>Sadly this handling does not seem to be enough, I have observed qmi responses to arrive on the transiently opened device.<br>This causes breakdown of the transaction handling (all requests get a timeout) and eventual hangs of qmi-proxy<br>where it does not respond to exit signals anymore (I am not sure how, since I am not familiar with the libqmi code).<br><br>I have made an strace of qmi-proxy and attached a full version for further debugging, but the behaviour described above is visible:<br>Abbreviated trace (...) first number is line number second PID:<br>  1297  5436  openat(AT_FDCWD, "/dev/cdc-wdm0", O_RDWR|O_EXCL|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = 8<br>  1433  5436  openat(AT_FDCWD, "/dev/cdc-wdm0", O_RDWR|O_EXCL|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = 10<br>  1577  5436  openat(AT_FDCWD, "/dev/cdc-wdm0", O_RDWR|O_EXCL|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = 12<br>  1676  5436  write(8, "\1\v\0\0\0\0\0\1!\0\0\0", 12) = 12<br>  1697  5436  write(8, "\1\v\0\0\0\0\0\2!\0\0\0", 12) = 12<br>  1760  5436  read(8, "\1\204\0\200\0\0\1\1!\0y" ... , 2048) = 133<br>  1784  5436  read(12, "\1\204\0\200\0\0\1\2!\0y" ... , 2048) = 133<br>  1830  5436  write(8, "\1\v\0\0\0\0\0\3!\0\0\0", 12) = 12<br>  1850  5436  write(8, "\1\v\0\0\0\0\0\4!\0\0\0", 12) = 12<br>  1880  5436  read(8,  "\1\204\0\200\0\0\1\3!\0y" ... , 2048) = 133<br>  1890     5436  write(1, ... "[30 Apr 2024, 12:05:52] [Debug] [/dev/cdc-wdm0] No transaction matched in received message\n, 4096) = 4096<br><br>In my opinion this is a fairly severe bug since it defeats the entire existence of qmi-proxy, it cannot be reliably used to concurrently use a qmi device.<br>A proper fix would probably prevent the same device being open multiple times in the first place.<br>I would love to open a pull request, but since I am not a glib developer and it is not trivial to do I cannot justify it.<br><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" style="font-size:1px;direction:ltr"><table cellpadding="0" cellspacing="0" border="0" style="width:100%;border-collapse:collapse;font-size:1px"><tbody><tr style="font-size:0"><td align="left"><table cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;font-size:0"><tbody><tr style="font-size:0"><td align="left" style="vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="width:100%;border-collapse:collapse;font-size:0"><tbody><tr style="font-size:0"><td align="left" style="padding:10px 0;vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="width:100%;border-collapse:collapse;font-size:0"><tbody><tr style="font-size:0"><td align="left" style="vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="white-space:nowrap;color:#000001;font-size:12px;font-family:Arial;font-weight:400;font-style:normal;text-align:left;line-height:16px;border-collapse:collapse"><tbody><tr style="font-size:12px"><td style="font-family:Arial">Eduard Strehlau<span style="font-family:remialcxesans;font-size:1px;color:#ffffff;line-height:1px"><span style="font-family:'template-x_CzGZimEeyiKigYeDLr3w'"></span><span style="font-family:'zone-1'"></span><span style="font-family:'zones-AQ'"></span></span></td></tr></tbody></table></td></tr><tr style="font-size:0"><td align="left" style="vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;font-size:0"><tbody><tr style="font-size:0"><td align="left" style="padding:5px 0 0;vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="white-space:nowrap;color:#000001;font-size:12px;font-family:Arial;font-weight:700;font-style:normal;text-align:left;line-height:16px;border-collapse:collapse"><tbody><tr style="font-size:12px"><td style="font-family:Arial">Lionizers GmbH</td></tr></tbody></table></td></tr></tbody></table></td></tr><tr style="font-size:0"><td align="left" style="vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="white-space:nowrap;color:#000001;font-size:12px;font-family:Arial;font-weight:400;font-style:normal;text-align:left;line-height:16px;border-collapse:collapse"><tbody><tr style="font-size:12px"><td style="font-family:Arial">Bremer Straße 18<br></td></tr></tbody></table></td></tr><tr style="font-size:0"><td align="left" style="vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="white-space:nowrap;color:#000001;font-size:12px;font-family:Arial;font-weight:400;font-style:normal;text-align:left;line-height:16px;border-collapse:collapse"><tbody><tr style="font-size:12px"><td style="font-family:Arial">21073 Hamburg</td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr style="font-size:0"><td align="left" style="vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;font-size:0"><tbody><tr style="font-size:0"><td align="left" style="padding:0;vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="white-space:nowrap;color:#000001;font-size:12px;font-family:Arial;font-weight:400;font-style:normal;text-align:left;line-height:16px;border-collapse:collapse"><tbody><tr style="font-size:12px"><td style="font-family:Arial">Telefon:<br></td></tr></tbody></table></td><td align="left" style="padding:0;vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="white-space:nowrap;color:#000001;font-size:12px;font-family:Arial;font-weight:400;font-style:normal;text-align:left;line-height:16px;border-collapse:collapse"><tbody><tr style="font-size:12px"><td style="font-family:Arial">+49 40 325084‑23<br></td></tr></tbody></table></td></tr><tr style="font-size:0"><td align="left" style="padding:0;vertical-align:top"></td><td align="left" style="padding:0;vertical-align:top"></td></tr><tr style="font-size:0"><td align="left" style="padding:0;vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="white-space:nowrap;color:#000001;font-size:12px;font-family:Arial;font-weight:400;font-style:normal;text-align:left;line-height:16px;border-collapse:collapse"><tbody><tr style="font-size:12px"><td style="font-family:Arial">Webseite: </td></tr></tbody></table></td><td align="left" style="padding:0;vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="white-space:nowrap;color:#000001;font-size:12px;font-family:Arial;font-weight:400;font-style:normal;text-align:left;line-height:16px;border-collapse:collapse"><tbody><tr style="font-size:12px"><td style="font-family:Arial"><a href="https://lionizers.com/" title="https://lionizers.com/" style="text-decoration:none;color:#000001" target="_blank">lionizers.com</a></td></tr></tbody></table></td></tr><tr style="font-size:0"><td align="left" style="padding:0;vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="white-space:nowrap;color:#000001;font-size:12px;font-family:Arial;font-weight:400;font-style:normal;text-align:left;line-height:16px;border-collapse:collapse"><tbody><tr style="font-size:12px"><td style="font-family:Arial">LinkedIn:</td></tr></tbody></table></td><td align="left" style="padding:0;vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="white-space:nowrap;color:#000001;font-size:12px;font-family:Arial;font-weight:400;font-style:normal;text-align:left;line-height:16px;border-collapse:collapse"><tbody><tr style="font-size:12px"><td style="font-family:Arial"><a href="https://www.linkedin.com/company/lionizers" style="text-decoration:none;color:#000001" target="_blank">lionizers</a><br></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr style="font-size:0"><td align="left" style="vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;font-size:0"><tbody><tr style="font-size:0"><td align="left" style="padding:20px 0;vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="white-space:normal;color:#000001;font-size:12px;font-family:Arial;font-weight:400;font-style:normal;text-align:left;line-height:16px;border-collapse:collapse"><tbody><tr style="font-size:12px"><td style="font-family:Arial">🦁🧡 <span style="font-weight:700">Wir bringen Digitalisierung und Nachhaltigkeit zusammen. #lionisieren</span><br></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr style="font-size:0"><td align="left" style="vertical-align:top"><table cellpadding="0" cellspacing="0" border="0" style="white-space:normal;color:#c0c0c0;font-size:12px;font-family:Arial;font-weight:400;font-style:normal;text-align:justify;line-height:16px;width:100%;border-collapse:collapse"><tbody><tr style="font-size:10.67px"><td style="font-family:Arial">Sitz: Hamburg, Amtsgericht Hamburg HRB 143339<br>Geschäftsführer: Nils Löwe, Friederike Löwe<br>USt-IdNr. gemäß §27a Umsatzsteuergesetz: DE308701380 - Finanzamt Hamburg<br></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></div></div></div>