Skip to content

Dispose the devices the adapter creates for its own event replay - #87

Open
Kinchul wants to merge 1 commit into
SuessLabs:developfrom
fiveco:vk/dispose-replayed-devices
Open

Dispose the devices the adapter creates for its own event replay#87
Kinchul wants to merge 1 commit into
SuessLabs:developfrom
fiveco:vk/dispose-replayed-devices

Conversation

@Kinchul

@Kinchul Kinchul commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Details

Mostly documentation, plus one small fix.

Every Device registers a D-Bus match rule in Device.CreateAsync, and that rule is released only when the Device is disposed. A connection is limited to max_match_rules_per_connection (2048 by default), so a consumer that discards the devices it receives eventually exhausts the limit and BlueZ calls start failing.

Device is IDisposable, but nothing stated that the devices delivered by DeviceFound and returned by GetDevicesAsync, GetDeviceAsync and WatchDevicesAddedAsync belong to the caller. This documents it on all four. We spent a long time tracking that down in #19, where the measurements are.

The one code change: TrackDeviceForConnection left its Device undisposed when tracking failed after creation. The catch releases the reserved slot, so nothing else can reach that device afterwards.

No API or behaviour change.

@Kinchul
Kinchul force-pushed the vk/dispose-replayed-devices branch from 5301681 to d51f69f Compare August 18, 2026 10:52
@Kinchul Kinchul changed the title Share one Device per object path so match rules stop accumulating Dispose the devices the adapter creates for its own event replay Aug 18, 2026
@Kinchul
Kinchul force-pushed the vk/dispose-replayed-devices branch from d51f69f to 009ee7c Compare August 18, 2026 12:25
@Kinchul
Kinchul force-pushed the vk/dispose-replayed-devices branch from 009ee7c to 0b334d0 Compare August 18, 2026 12:26
@Kinchul
Kinchul marked this pull request as ready for review August 18, 2026 12:31
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