fix(mqtt): retire session workers on reconnect - #44
Conversation
84beb7c to
8fe946d
Compare
|
The diagnosis is right and the per-session stop event is the fix. Orphaned workers waiting on a bridge-lifetime event explains the #9 evidence better than anything I had. One change before I merge it. The workers now wait only on Before this PR, Simplest fix is to keep a handle on the event, something like Unrelated and non-blocking: the new CI is green and the worker-lifecycle test reads well, particularly the forced start failure. |
8fe946d to
8c374e1
Compare
|
Fixed in I added regressions for shutdown while I left the callback null-outs in both places deliberately: |
|
That closes it, thanks. Fair enough on keeping both callback null-outs. That reasoning holds. Merging. |
Fixes #9.
Each DTLS reconnect starts a new PollScheduler, KeepaliveTask, and ObserveRefreshTask, but those workers currently wait on the bridge-lifetime
self.stopevent. Clearing their references at teardown therefore leaves the old workers running against a closed session. That fits the long-run evidence in #9: orphaned six-hour OBSERVE refresh timers accumulate and eventually fire at a much shorter apparent cadence.This change:
The regression tests cover consecutive sessions, reader failure, partial thread startup, shutdown while the reader remains joined, and shutdown just before the session-event handoff. They verify that reconnect does not poison the bridge-wide event, shutdown wakes active workers immediately, each session gets a distinct event, callbacks are retired, and all workers exit before teardown returns.
Validation:
This is one commit on current
main, after #42, #43, and #45. It remains independent of #36.