Skip to content

fix(mqtt): avoid driver deadlock when re-subscribing many filters#18

Merged
ashaffah merged 1 commit into
mainfrom
fix/mqtt-shared-resubscribe-deadlock
Jun 29, 2026
Merged

fix(mqtt): avoid driver deadlock when re-subscribing many filters#18
ashaffah merged 1 commit into
mainfrom
fix/mqtt-shared-resubscribe-deadlock

Conversation

@ashaffah

Copy link
Copy Markdown
Owner

On (re)connect the shared-connection driver re-subscribed every mqtt-in filter inline with client.subscribe().await. Each call only enqueues a request into a bounded channel (capacity 10) that is drained solely by the driver's own poller.poll(). Awaiting the subscribes inline meant the driver was not polling, so once the queue filled the next subscribe blocked forever, deadlocking the whole connection: no further subscribes completed and no publishes were sent.

A flow with more than ~10 mqtt-in nodes on one shared broker therefore went completely silent on connect. Move the re-subscribe + birth publish into a detached task so the event loop keeps polling and the request queue drains.

On (re)connect the shared-connection driver re-subscribed every mqtt-in
filter inline with `client.subscribe().await`. Each call only enqueues a
request into a bounded channel (capacity 10) that is drained solely by the
driver's own `poller.poll()`. Awaiting the subscribes inline meant the
driver was not polling, so once the queue filled the next subscribe blocked
forever, deadlocking the whole connection: no further subscribes completed
and no publishes were sent.

A flow with more than ~10 mqtt-in nodes on one shared broker therefore went
completely silent on connect. Move the re-subscribe + birth publish into a
detached task so the event loop keeps polling and the request queue drains.
@ashaffah ashaffah merged commit 5b0959a into main Jun 29, 2026
1 check passed
@ashaffah ashaffah deleted the fix/mqtt-shared-resubscribe-deadlock branch July 1, 2026 02:00
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