[Pkg-gtkpod-devel] Bug#1153784: libusbmuxd-2.0-7: upowerd stuck at 100% CPU in trixie; cause and fix identified

Daniel Oswaldo Guerrero Herrera oswalldogrro at gmail.com
Thu Nov 12 01:15:24 GMT 2026


Package: libusbmuxd-2.0-7
Version: 2.1.0-1+b1
Severity: important
Tags: patch upstream fixed-upstream
Control: fixed -1 2.1.1-1
Control: affects -1 upower

Dear Maintainer,

Summary:

- Problem: after I connected an iPhone over USB to charge it, upowerd
  got stuck using 100% of one CPU core and stopped answering D-Bus
  clients.
- Cause: in libusbmuxd 2.1.0, usbmuxd_send() returns a positive value
  on error. libimobiledevice treats it as "success, 0 bytes sent" and
  retries forever.
- Fix: one line, already in 2.1.1-1 (sid), upstream commit
  bb6a786b676ab5ea6a1a13b5c14ddd965d7583fc
  ("Fix usbmuxd_send returning positive value on error"):

    -           return -num_sent;
    +           return num_sent;

  Please consider it for a trixie point release.

Details below.

What I saw:

"upower -e" printed (locale es_MX; the message means "timeout
reached"):

  libupower-glib-WARNING **: up_client_get_devices failed: Se alcanzó el
tiempo de expiración
  Failed to get device list

Over 5 seconds, /proc/<pid>/io counters (wchar, syscw) of upowerd did
not change and /proc/<pid>/syscall showed "running". At that point no
Apple USB device was present and usbmuxd.service was inactive.
I observed this once and did not try to reproduce it on demand.

Code path (Debian sources, trixie):

1. libimobiledevice-glue 1.3.1-1, socket_send(): returns -errno on
   failure.

2. libusbmuxd 2.1.0-1, src/libusbmuxd.c, usbmuxd_send():
       num_sent = socket_send(sfd, (void*)data, len);   /* -errno */
       if (num_sent < 0) {
           *sent_bytes = 0;
           return -num_sent;                            /* +errno */
       }

3. libimobiledevice 1.3.0+git20250228-2, src/idevice.c,
   internal_connection_send(): only "res < 0" is an error, so a
   positive value returns IDEVICE_E_SUCCESS with *sent_bytes = 0.

4. Same file, idevice_connection_send(), lines 705-712:
       while (sent < len) {
           int s = internal_connection_send(..., &bytes);
           if (s < 0) break;
           sent += bytes;                               /* += 0 */
       }
   This never ends.

Backtrace of the spinning upowerd thread (eu-stack with
debuginfod.debian.net; three samples 1 s apart, all in this path):

  #5  usbmuxd_send            libusbmuxd.c:1592
  #6  internal_connection_send idevice.c:640
  #7  idevice_connection_send idevice.c:707
  #8  service_send            service.c:145
  #9  internal_plist_send     property_list_service.c:133
  #10 lockdownd_send          lockdown.c:355
  #11 lockdownd_get_value     lockdown.c:423
  #12 lockdownd_do_pair       lockdown.c:928
  #13 lockdownd_pair          lockdown.c:1069
  #14 lockdownd_client_new_with_handshake  lockdown.c:731
  #15 up_device_idevice_refresh  up-device-idevice.c:241 (upower 1.90.9-1)

System: Debian 13 (trixie), kernel 6.12.116+deb13-amd64, amd64,
libc6 2.41-12+deb13u4.

------------------------------------------------
Package: libusbmuxd-2.0-7
Version: 2.1.0-1+b1
Severity: important
Tags: patch upstream fixed-upstream
Control: fixed -1 2.1.1-1
Control: affects -1 upower

Estimado responsable del paquete:

Resumen:

- Problema: después de conectar un iPhone por USB para cargarlo,
  upowerd se atoró usando el 100 % de un núcleo del procesador y dejó
  de responder a los programas que le preguntan por D-Bus.
- Causa: en libusbmuxd 2.1.0, usbmuxd_send() devuelve un valor
  positivo cuando hay un error. libimobiledevice lo toma como "éxito,
  0 bytes enviados" y reintenta para siempre.
- Arreglo: una línea, ya incluida en 2.1.1-1 (sid), commit original
  bb6a786b676ab5ea6a1a13b5c14ddd965d7583fc
  ("Corrige que usbmuxd_send devuelva un valor positivo en error"):

    -           return -num_sent;
    +           return num_sent;

  Les pido considerarlo para una actualización de trixie.

Detalles abajo.

Lo que vi:

"upower -e" mostró (idioma es_MX; el mensaje significa "se agotó el
tiempo"):

  libupower-glib-WARNING **: up_client_get_devices failed: Se alcanzó el
tiempo de expiración
  Failed to get device list

Durante 5 segundos, los contadores de /proc/<pid>/io (wchar, syscw) de
upowerd no cambiaron y /proc/<pid>/syscall mostraba "running". En ese
momento no había ningún aparato Apple conectado por USB y
usbmuxd.service estaba inactivo.
Lo observé una vez y no intenté reproducirlo a propósito.

Ruta del código (fuentes de Debian, trixie):

1. libimobiledevice-glue 1.3.1-1, socket_send(): si falla, devuelve
   -errno (negativo).

2. libusbmuxd 2.1.0-1, src/libusbmuxd.c, usbmuxd_send():
       num_sent = socket_send(...);   /* -errno */
       si num_sent < 0:
           *sent_bytes = 0;
           return -num_sent;          /* +errno: signo al revés */

3. libimobiledevice 1.3.0+git20250228-2, src/idevice.c,
   internal_connection_send(): solo considera error si "res < 0", así
   que un valor positivo devuelve ÉXITO con *sent_bytes = 0.

4. Mismo archivo, idevice_connection_send(), líneas 705-712:
       mientras enviado < total:
           s = internal_connection_send(...);
           si s < 0: salir
           enviado += bytes;          /* += 0 */
   Esto nunca termina.

Traza del hilo de upowerd que gira (eu-stack con debuginfod.debian.net;
tres muestras con 1 s de diferencia, todas en esta ruta):

  #5  usbmuxd_send             libusbmuxd.c:1592
  #6  internal_connection_send idevice.c:640
  #7  idevice_connection_send  idevice.c:707
  #8  service_send             service.c:145
  #9  internal_plist_send      property_list_service.c:133
  #10 lockdownd_send           lockdown.c:355
  #11 lockdownd_get_value      lockdown.c:423
  #12 lockdownd_do_pair        lockdown.c:928
  #13 lockdownd_pair           lockdown.c:1069
  #14 lockdownd_client_new_with_handshake  lockdown.c:731
  #15 up_device_idevice_refresh  up-device-idevice.c:241 (upower 1.90.9-1)

Sistema: Debian 13 (trixie), kernel 6.12.116+deb13-amd64, amd64,
libc6 2.41-12+deb13u4.




-- 
Sin mas que decir, quedo a sus ordenes.


M.S.C. Daniel Oswaldo Guerrero Herrera
+52 (565)-157-6916
oswalldogrro at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-gtkpod-devel/attachments/20261111/7726bdc3/attachment.htm>


More information about the Pkg-gtkpod-devel mailing list