Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Rp2040 and Host os_timer_setfn() can stall other timers #2672

Merged
merged 1 commit into from
Oct 12, 2023

Conversation

mikee47
Copy link
Contributor

@mikee47 mikee47 commented Oct 11, 2023

If called on first timer in queue then subsequent timers get disconnected. Must explicitly disarm the timer first so it's properly removed from queue. This is consistent with esp8266 behaviour.

Also applied to host timer from whence the code originated.
This bug might explain root cause of #2594, where code hangs during intensive timer usage. Specifically, this issue gets triggered if attempting to change the callback on an active timer. (If the timer is inactive then it's not in the queue so doesn't matter.)

@what-the-diff
Copy link

what-the-diff bot commented Oct 11, 2023

PR Summary

  • Insuring Against Null Pointer in Timer Setup Function
    The team has added a safeguard in the timer setup function (os_timer_setfn). Now, if the system encounters something called a 'null pointer', it won't result in an error. This makes the overall codes safer and more robust.

  • Pre-Emptive Handling of Null Pointer Scenario
    The process to handle this 'null pointer' case now occurs earlier, before the timer gets adjusted. This means potential issues are caught and addressed sooner, enhancing the system's reliability.

  • Disabling Timer Before Modification
    The developers have included a new step where the timer is 'disarmed' before being modified. This scheduling tweak improves the accuracy of our timing tasks and enhances the system's performance by ensuring any modifications don't accidentally trigger the timer.

@mikee47 mikee47 changed the title Bugfix: Rp2040 os_timer_setfn() can stall other timers. Bugfix: Rp2040 and Host os_timer_setfn() can stall other timers Oct 11, 2023
@slaff slaff added this to the 5.1.0 milestone Oct 11, 2023
If called on first timer in queue then subsequent timers get disconnected.
Must explicitly `disarm` the timer first so it's properly removed from queue.
@slaff slaff merged commit b153bc8 into SmingHub:develop Oct 12, 2023
36 checks passed
@mikee47 mikee47 deleted the fix/rp2040-timer branch October 12, 2023 08:30
@slaff slaff mentioned this pull request Oct 24, 2023
5 tasks
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