Skip to content

Characteristic notification handler goroutine leak #260

Open
@Elara6331

Description

@Elara6331

When notifications are enabled on a DeviceCharacteristic on Linux, it starts a new goroutine listening on a channel for DBus signals, but when a device disconnects (or when EnableNotifications(nil) is called), the c.property channel is never closed, so the goroutine will keep waiting for a signal on its property channel.

In the case of EnableNotifications(nil), the goroutine will sleep forever and the signal will never come due to the call to RemoveSignal here:

c.adapter.bus.RemoveSignal(c.property)

However, when a device disconnects, RemoveSignal is never called, so when a new notification handler is added to that characteristic after the device reconnects, the MatchSignal is re-added, so the old goroutine starts receiving signals again and executes its old handler, causing duplicated events and other undesirable issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions