Skip to content

reconnection triggered by lost and onavailable race for the semaphore, causing intermittent issues #2202

@growse

Description

@growse

Location: MQTTMessageProcessorEndpoint.kt:85, 102, 110

When onAvailable and onLost fire in close succession, both launch coroutines that compete for the connectingLock semaphore:

onAvailable → reconnect() acquires lock → calls disconnect() then connectToBroker() → connection established
onLost → disconnect() is waiting for the lock
reconnect() finishes and releases the lock
onLost acquires the lock → disconnects the freshly established connection
No further reconnect is triggered

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