## Impact

blueman-applet crashes with a `KeyError` in
`ShowConnected.on_device_property_changed()` when BlueZ reports
`Connected=false` for a device path that was never observed as connected.
That happens with devices that connect transiently without being paired —
e.g. sending a file from a phone that is not known to this machine. The
daemon dies and the session loses its Bluetooth status icon.

`ShowConnected` tracks connected paths in a `set` and uses `set.remove()`
for the `Connected=false` transition, which raises when the path is absent:

    self._connections.remove(path)      # ShowConnected.py:101

This bucket is 191 crashes/week on Ubuntu 26.04. The set-based code is
2.4.x-only: noble's 2.3.5 uses a connection counter and is not affected,
so no noble task is needed.

Fixed upstream in ba2ef4b9 (`remove()` -> `discard()`); it is in no
release.

## Test Plan

Prepared package: 2.4.4-1ubuntu0.1 (debdiff attached; it becomes available
in resolute-proposed once sponsored and accepted).

1. Unit-level: load the `ShowConnected` plugin in a running applet and
   deliver `on_device_property_changed(path, "Connected", False)` for a
   path that was never added:
   - unpatched: the applet exits with the `KeyError` from this bug;
   - patched: no exception, status icon unchanged.

   Already run against the prepared tree (stock 2.4.4 and patched):
   stock raises the KeyError, patched returns cleanly.

2. End-to-end, per the upstream reproduction: send a file over OBEX from a
   phone that is not paired with the machine. The device connects
   transiently and disconnects without a `Connected=true` having been
   observed:
   - unpatched: blueman-applet dies during/after the transfer;
   - patched: the applet survives.

3. Regression: pair a headset, connect it, then disconnect it. The
   connection count shown in the applet tooltip still goes up and back
   down.

## Where problems could occur

`discard()` is a no-op when the path is absent, which is exactly the
failure case, so behaviour for paths that *were* added is unchanged.

## Other Info

Same upload as LP #2082533 (`AssertionError` in `Manager._on_object_removed`);
both are backports of upstream master commits, neither in any release.


** Patch added: "resolute (26.04) debdiff: blueman 2.4.4-1build1 -> 
2.4.4-1ubuntu0.1"
   
https://bugs.launchpad.net/bugs/2190870/+attachment/6025247/+files/resolute.debdiff

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

Title:
  blueman-applet crashed with KeyError in on_device_property_changed()

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/blueman/+bug/2190870/+subscriptions


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

Reply via email to