Skip to content

Conversation

Bwooce
Copy link

@Bwooce Bwooce commented Jul 26, 2025

Summary

  • Fix scheduler feedback loop causing 6000+ NodeStatus messages per second flooding the CAN bus
  • Fix GUI responsiveness by limiting frames processed per spin(0) call to prevent infinite loops
  • Maintain proper periodic timing while preventing callback overlap

Technical Details

  • Scheduler Fix: Prevent callback overlap in periodic scheduler that was causing runaway NodeStatus generation when callbacks took longer than the period
  • GUI Fix: Limit spin(0) to process maximum 100 frames per call to prevent GUI thread blocking

@Bwooce Bwooce changed the title Rate limiting only Rate limiting on NodeStatus messages from DroneCAN GUI Jul 26, 2025
When SLCAN ACK/NACK waits were removed to support adapters without
confirmation, the scheduler's timing assumptions broke. The periodic
scheduler would re-register the next NodeStatus event before the
current callback completed, causing a runaway loop when SLCAN frame
transmission included time.sleep() calls.

This fix prevents callback overlap by:
- Adding callback_running flag to track execution state
- Skipping overlapping executions and rescheduling for next period
- Using try/finally to ensure flag is always reset

Resolves 6000+ NodeStatus messages/second flooding issue while
maintaining proper 1Hz timing and DroneCAN compliance.
@Bwooce Bwooce force-pushed the rate-limiting-only branch from f384a34 to 383ce8e Compare July 26, 2025 13:16
@Bwooce Bwooce changed the title Rate limiting on NodeStatus messages from DroneCAN GUI Fix NodeStatus message flooding caused by scheduler feedback loop Jul 26, 2025
@Bwooce
Copy link
Author

Bwooce commented Jul 27, 2025

Apologies for the churn here, on further testing there were...more problems. I've attempted to keep this PR seperate from the ACK/NACK change one to facilitate testing/validation that it's not broken the world before the ACK/NACK change gets merged.

@Bwooce Bwooce changed the title Fix NodeStatus message flooding caused by scheduler feedback loop Fix NodeStatus flooding and GUI responsiveness issues Jul 27, 2025
- Fix periodic scheduler callback overlap preventing NodeStatus flooding
- Add GUI responsiveness protection by limiting frames per spin cycle
- Improve transfer reassembly with proactive cleanup and shorter timeouts
- Fix dictionary iteration bug in transfer cleanup

These changes resolve NodeStatus flooding and GUI freezing issues
while improving frame decode reliability.
@Bwooce Bwooce force-pushed the rate-limiting-only branch from a1794f7 to d9acd2e Compare July 27, 2025 10:38
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