Skip to content

fix(mqtt): stop no longer leaks the shared connection driver#10

Merged
ashaffah merged 1 commit into
mainfrom
fix/mqtt-stop-driver-leak
Jun 26, 2026
Merged

fix(mqtt): stop no longer leaks the shared connection driver#10
ashaffah merged 1 commit into
mainfrom
fix/mqtt-stop-driver-leak

Conversation

@ashaffah

Copy link
Copy Markdown
Owner

When a shared MQTT connection was torn down while the broker was unreachable, the client's request queue could be full (inject kept publishing), so disconnect().await blocked. The node then missed the graceful window and was aborted before stopping the connection's driver task — which kept reconnecting and emitting errors, so Stop appeared to do nothing.

Time-bound the graceful close (500ms) and always abort the driver after, so Stop reliably tears the connection down. Verified: Stop returns in ~0.5s and errors cease (previously hung 2s and kept erroring).

When a shared MQTT connection was torn down while the broker was
unreachable, the client's request queue could be full (inject kept
publishing), so `disconnect().await` blocked. The node then missed the
graceful window and was aborted before stopping the connection's driver
task — which kept reconnecting and emitting errors, so Stop appeared to
do nothing.

Time-bound the graceful close (500ms) and always abort the driver after,
so Stop reliably tears the connection down. Verified: Stop returns in
~0.5s and errors cease (previously hung 2s and kept erroring).
@ashaffah ashaffah merged commit de191f7 into main Jun 26, 2026
1 check passed
@ashaffah ashaffah deleted the fix/mqtt-stop-driver-leak branch July 1, 2026 02:01
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