Public bug reported:

Package: geoclue-2.0 2.7.2-2ubuntu3 (deadlock is in GLib / libproxy)

Release: Ubuntu 26.10, kernel 7.3.0-10-generic
Versions:
  geoclue-2.0      2.7.2-2ubuntu3
  libglib2.0-0t64  2.90.0-1
  glib-networking  2.90.0-2
  libproxy1v5      0.5.12-3
  systemd          261.3-0ubuntu3

Symptom
-------
geoclue.service (Type=dbus) never acquires org.freedesktop.GeoClue2 and is
killed after the 90 s start timeout, on every boot and on every manual start:

  systemd[1]: geoclue.service: start operation timed out. Terminating.
  systemd[1]: geoclue.service: Failed with result 'timeout'.
  gnome-shell: Error calling StartServiceByName for org.freedesktop.GeoClue2: 
Timeout was reached
  gsd-color:   Failed to connect to GeoClue2 service: ... Timeout was reached

Automatic timezone and Night Light sunrise/sunset do not work as a
result.

Analysis
--------
The process is not blocked on any D-Bus peer (ModemManager, wpa_supplicant,
NetworkManager and avahi all respond), there are no AppArmor denials, and the
D-Bus policy is fine. It is a lock-order deadlock inside GIO at startup.

gdb backtraces of the hung process (relevant frames):

Main thread:
  #0 futex_wait
  #3 pthread_mutex_lock
  #5 g_vfs_get_default ()            libgio-2.0.so.0
  #6 g_file_new_for_path ()
  ... g_object_new ... g_initable_new ()

Thread "pool-0":
  #2  g_once_init_enter_pointer ()
  #3  g_vfs_get_default ()            libgio-2.0.so.0
  #4  g_file_new_for_path ()
  #5  ?? ()                           libpxbackend-1.0.so
  ... g_object_new ...
  #13 px_manager_new_with_options ()  libpxbackend-1.0.so
  #14 px_proxy_factory_new ()         libproxy.so.1
  #15 ?? ()                           gio/modules/libgiolibproxy.so
  ... g_object_new ...
  #22 g_proxy_resolver_get_default () libgio-2.0.so.0

Thread "pool-1":
  #2 g_once_init_enter_pointer ()
  #3 g_proxy_resolver_get_default ()

So the main thread is inside g_vfs_get_default() waiting on a mutex, while a
worker thread is initialising the default GProxyResolver (libgiolibproxy ->
libproxy -> g_file_new_for_path()) and waits on the g_vfs_get_default() once.
Neither proceeds.

Reproducibility / timing
------------------------
100% reproducible here under the shipped unit. It is timing dependent: running
/usr/libexec/geoclue manually as the geoclue user outside systemd starts in
~15 ms. Bisecting the unit's sandboxing with systemd-run, the hang only occurs
with ProtectKernelTunables=yes (removing only that option makes it start), but
that option merely changes timing; the deadlock itself is in GIO/libproxy.

  sudo systemd-run --unit=gc-test -p User=geoclue -E GSETTINGS_BACKEND=memory \
    -p ProtectKernelTunables=yes -p RuntimeMaxSec=10 /usr/libexec/geoclue

Workaround
----------
Forcing the dummy proxy resolver avoids libproxy initialisation and geoclue
starts reliably (3/3 runs with full unit sandbox; 0/3 without it, 0/3 with
GIO_USE_PROXY_RESOLVER=gnome):

  sudo systemctl edit geoclue
  [Service]
  Environment=GIO_USE_PROXY_RESOLVER=dummy

** Affects: geoclue-2.0 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2173083

Title:
  geoclue.service times out at startup: GIO deadlock between
  g_vfs_get_default() and libproxy proxy resolver init

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/geoclue-2.0/+bug/2173083/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to