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

Fix #274: Avoid possible deadlock of timer callback #278

Merged
merged 1 commit into from
Nov 7, 2019

Conversation

jphickey
Copy link
Contributor

Describe the contribution
Fix issue #274, avoids timer callback deadlock if actual tick_time is consistently bigger than the configured iinterval_time.

Testing performed
Modify timer-test to choose an interval that is not a multiple of the system clock tick, such that it will be rounded up to the next tick by the implementation.

Verify that evenually, two callbacks are generated in a single time tick, such that the long-term average of callbacks over time is consistent with the configured interval_time.

Confirm that callbacks continue normally until the application is stopped, as expected.

Expected behavior changes
Callbacks no longer cease once the "overrun" condition occurs (callbacks behind by >=1 full interval time)

Confirm consistent behavior on POSIX, RTEMS, and VxWorks

System(s) tested on:
Ubuntu 18.04.2 LTS 64-bit (POSIX/simulation)
RTEMS 4.11 pc686 BSP running in QEMU
MPC750 VxWorks 6.9

Contributor Info
Joseph Hickey, Vantage Systems, Inc.

If the tick_time from the wait routine was perpetually
greater than the interval time, eventually the wait_time
became such that it was always below zero.  Once this
occurs, application callbacks would cease entirely.

To avoid this, run the callback condition in a loop
for periodic timers only (not for one-shot config).
@skliper
Copy link
Contributor

skliper commented Oct 31, 2019

CCB 20191030 - Code reviewed and approved

@skliper skliper added the CCB:Approved Indicates code review and approval by community CCB label Oct 31, 2019
skliper added a commit that referenced this pull request Oct 31, 2019
Fixes #271 #272 #273 #274
Code reviewed and approved at 20191030 CCB
@skliper skliper changed the base branch from master to ic-20191030 November 7, 2019 21:06
@skliper skliper merged commit 1f450b2 into ic-20191030 Nov 7, 2019
@skliper skliper deleted the fix-274-timer-deadlock branch November 7, 2019 21:06
@skliper skliper added this to the 5.1.0 milestone Jun 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCB:Approved Indicates code review and approval by community CCB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants