Skip to content

omamobile-gnss 0.2.11: GeoClue's start can't deadlock in GLib's proxy lookup - #942

Open
W4HO-ham wants to merge 1 commit into
derekross:mainfrom
W4HO-ham:gnss-geoclue-start-deadlock
Open

W4HO-ham wants to merge 1 commit into
derekross:mainfrom
W4HO-ham:gnss-geoclue-start-deadlock

Conversation

@W4HO-ham

@W4HO-ham W4HO-ham commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

With glib2 2.90.1 GeoClue's start sometimes stops before it takes its bus name. The location request that started it fails after D-Bus's 25 s ("Failed to connect to GeoClue2 service: Error calling StartServiceByName"), and the app gets nothing. This is the stall my #921 and #925 runs listed as "cause open": 4 of the 36 boots on the published kernel in #925's record, each with a request about 16 s into the boot, and one more of 8 last night.

The cause is a lock-order deadlock between two GLib one-time setups, and it is known upstream: GLib issue 4078 (opened 2026-10-17, closed). I found that only after writing the first version of this; the description then said it wasn't reported, which was wrong. From the backtraces of two stalled starts (every thread, function names; both from the loop below, on the daily kernel):

  • The main thread: g_file_new_for_path → g_vfs_get_default → pthread_mutex_lock. It holds the VFS's one-time init and waits for GIO's default-modules lock.
  • A pool thread: g_proxy_resolver_get_default → glib-networking's libgiolibproxy.so → px_proxy_factory_new → px_manager_new_with_options → g_file_new_for_path → g_vfs_get_default → g_once_init_enter → g_cond_wait. It holds the default-modules lock while libproxy's resolver is created, and libproxy's init waits for the VFS's one-time init.
  • Three more pool threads wait in g_once_init_enter under g_proxy_resolver_get_default.

Versions on the palmtop (Arch Linux ARM): geoclue 2.8.2-2, glib2 2.90.1-1, glib-networking 2.90.1-1, libproxy 0.5.12-1, libsoup3 3.8.1-1.

The change is one drop-in for geoclue.service in omamobile-gnss: Environment=GIO_USE_PROXY_RESOLVER=dummy. GIO then creates its own built-in resolver under that lock, which opens no file, so the pool thread's half can't happen. Nothing is lost: GeoClue turns proxies off for its web lookups itself (soup_session_set_proxy_resolver (session, NULL) in gclue-web-source.c; the packaged binary imports it), so the default resolver only served the reachability check. The first version of the file's comment said a phone could get proxies back with a later drop-in; it couldn't, and that paragraph is gone. The file can go once the image's glib2 carries upstream's fix, and its comment says so.

On my palmtop (Pixel 9a, 7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty, the daily bring-up kernel, 2026-11-20). A loop stops GeoClue, starts it through its bus name (busctl call ... org.freedesktop.DBus.Peer Ping, 12 s) and counts the starts that never take the name; no reboots. For the loop the drop-in was a file of the same content in /etc/systemd/system/geoclue.service.d, and the loop's last line printed the unit's Environment in each run.

without the drop-in with it
the file cache dropped before each start, as after a boot 7 of 80 stopped (6 of 40 before the run with it, 1 of 40 after) 0 of 80
warm cache 2 of 180 0 of 200

The counts are thin on their own: the two blocks without it differ a lot, and the warm row alone separates nothing. What carries the claim is the mechanism, which the drop-in removes by construction, and the upstream issue.

Then the file at its packaged path, the hand copy removed, and one boot with a request 18 s in:

DropInPaths=/usr/lib/systemd/system/geoclue.service.d/10-omamobile-gnss.conf /usr/lib/systemd/system/service.d/10-omamobile-tegu-sleep-watchdog.conf
Environment=GSETTINGS_BACKEND=memory GIO_USE_PROXY_RESOLVER=dummy

GeoClue was up at the request, the first position (IP) came at 61.6 s, when this kernel's Wi-Fi comes up, as in last night's boots without the file (60.4 to 60.8 s), and a GNSS fix at 81.9 s. tools/phone-smoke --here after it: 19 checks ok, none failed.

A run under CPU load (six busy loops during each start) I count only in part: its 80 starts without the drop-in are in the 180 above (none stopped); during the starts with it the palmtop reached its critical temperature and shut itself down in order (HARDWARE PROTECTION shutdown). That was my load loop, not GeoClue; it goes into the 9a's notes separately.

Not run:

Where it lives. GeoClue is in every image through omamobile-apps; omamobile-gnss is only in the Pixel 7 Pro's and the Pixel 6 Pro's lists (and on a 9a that has it). A phone without this package keeps the stall until glib2 is fixed. If you'd rather the file sat in a package every image has, say where and I'll move it.

Tests: test/all checks that the drop-in sets the built-in resolver and nothing else, and that install puts it under geoclue.service.d. The check sits before the test's "no bionic prebuilts" skip, so CI runs it. tests/all and tools/pr-check origin/main pass.

The version is 0.2.11, which #864 and #933 also take (#921 is 0.2.12). Equal version lines merge without a conflict, so the number needs setting by hand at merge; tell me which and I'll rebase.

W4HO-ham added a commit to W4HO-ham/omarchy-mobile that referenced this pull request Nov 20, 2026
…s#921's final head, and the GeoClue stall's cause

Eight more boots on the published kernel with derekross#921's final head had a GNSS fix
in seven; the eighth was GeoClue's start stall again, and this time its
backtrace was taken. It is a lock-order deadlock between GLib's VFS and proxy
resolver setups, reproduced without a boot (7 of 80 cold starts) and gone with
GLib's built-in resolver (derekross#942). The record no longer calls the cause open, and
says which overlay isn't in the tree.
… lookup

With glib2 2.90.1 GeoClue's start sometimes stopped before it took its
bus name, and the location request that started it failed after D-Bus's
25 s. It is GLib issue 4078, closed upstream and in no glib2 the image
has yet: the main thread opens a GFile (g_vfs_get_default() holds the
VFS's one-time init and waits for GIO's default-modules lock) while a
pool thread asks for the default proxy resolver
(g_proxy_resolver_get_default() holds that lock while libproxy's
resolver is created, whose init opens a GFile and waits for the VFS's
init).

A drop-in for geoclue.service names GLib's built-in resolver, which
opens no file under the lock. GeoClue uses no proxy for its web lookups
anyway (it sets its session's resolver to NULL), so nothing is lost.
The file can go once glib2 carries the fix.

On a Pixel 9a, with the file cache dropped before each start as after a
boot, 7 of 80 starts stopped that way without it and 0 of 80 with it.
@W4HO-ham
W4HO-ham force-pushed the gnss-geoclue-start-deadlock branch from f4909f8 to 6a76e08 Compare November 20, 2026 03:40
W4HO-ham added a commit to W4HO-ham/omarchy-mobile that referenced this pull request Nov 20, 2026
The record names the upstream issue, so the workaround in derekross#942 has a known end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant