Skip to content

Resynchronise after a stale LUBA transmit confirmation - #163

Merged
sde1000 merged 1 commit into
sde1000:masterfrom
tridonic-com:luba-robustness
Oct 19, 2026
Merged

sde1000 merged 1 commit into
sde1000:masterfrom
tridonic-com:luba-robustness

Conversation

@markus-becker-tridonic-com

Copy link
Copy Markdown
Contributor

Summary

On the Lunatone LUBA RS232 driver (DriverLubaRs232), a weak/busy bus can deliver a frame's "sent" confirmation after that send has already timed out. The late confirmation stays queued on _queue_tx_conf ahead of the next send's own confirmation. The next send then consumes the stale one, and because it never sees its own, every subsequent send inherits the same one-frame offset — the confirmation stream stays permanently desynchronised until the driver is restarted.

Fix

When the confirmation being awaited is for a different frame than the one just sent, discard it and keep waiting for the matching one. This is safe because sends are serialised under _tx_lock: nothing later is in flight yet, so a mismatched confirmation can only be a leftover from an earlier, already-timed-out send. The previous code logged this mismatch as an error and returned, which is exactly what left the stream offset.

The change is confined to the confirmation-matching branch in DriverLubaRs232.send_dali_command; the happy-path trace log is preserved, and a genuine error_code still raises TransmissionError as before.

Testing

New test_send_dali_command_resyncs_after_stale_confirmation queues a stale confirmation ahead of the real one and asserts the send drains both, recovers, and warns.
Full serial-driver suite passes (pytest dali/tests/test_serial_driver.py, 10 passed).

A weak bus can let a frame's "sent" confirmation arrive after its send has
already timed out, leaving it queued ahead of the next send's own. The next
send then matched the stale confirmation, and every later send inherited the
one-off mismatch, so the whole stream stayed desynchronised.

Sends are serialised under the transmit lock, so a confirmation for a
different frame can only be such a leftover; discard it and keep waiting for
this frame's own confirmation, letting the stream resynchronise.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sde1000
sde1000 merged commit ac8aa38 into sde1000:master Oct 19, 2026
5 checks passed
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.

2 participants