-
Notifications
You must be signed in to change notification settings - Fork 219
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
osal_timer_UT periodic failure #335
Comments
@jphickey any relation to the vxworks timer startup issue? |
Actual failure comes from the deltaTime = 498945 the 3rd time through, since the delta isn't checked on the first 2 frames. |
Now I'm confused. The start time is set to 1000, so in this case the unit under test did what was expected. I ran it a few more times and DID get it to pass, which is likely the actual error. |
Can't really add printf statements to the timer callback function, as these can disrupt the timing substantially - so I'm not sure if that observation is really what is happening or if it is just an artifact of doing the printf's. |
The timer is slow, and there is plenty of time to print prior to next call. They are after getting time. |
I understand it could effect it, but not worth bothering w/ a fancier test when the delay is .5 sec. It does illustrate an issue in the test, so why the pushback? |
I'll fix the test for the first issue identified and remove the printf's to retest (since start delay of 1000 is likely impacted by the printfs). |
Retracting this. When it does pass, the first interval is ~500000 as expected. Just a guess since for all the failure cases the first interval is ~1000 usec, but could it be the callback is inappropriately getting called before the start delay? This doesn't sound like expected behavior, although the ~1000 usec could be a coincidence it's suspect that it matches the start delay. |
I think this is coincidence ... The 1000usec initial start delay is pretty tight for a desktop Linux kernel which typically has tick rate of 100Hz, so this is unlikely to be accurate but it doesn't check the first interval anyway. I just ran the test a bunch of times and when it finally failed (after many successful runs) it was on the 10th interval, which according to the check was only 7us after the previous call. I will look closer. |
could it be related to the following comments? osal/src/os/shared/osapi-time.c Lines 358 to 370 in 155e9eb
Maybe the spurious callback case the first time through, then gets called after the start wait. |
Edited out Time design ignorance is showing... Only useful part of this comment was it's the first call to TimerSet. |
I think I know what the issue is.... This test is not comparing the elapsed interval to the expected interval, but rather the interval that came before it. So yeah, if the first interval is short (i.e. 1000us), it invalidates the second test which will end up comparing 1000us to 500000us and getting a difference of 499000us. I'm somewhat surprised this doesn't fail more often than it does. |
I'm currently testing a fix in a loop; if this runs repeatedly for an hour or so with no failures than I'll push it up. |
On POSIX, call sigtimedwait() on the selected RT signal as part of the set up for the timebase. This ensures that if the signal is already pending, it will be cleared. This also simplifies the timer callback routine in the UT code, cleaning up some unncessary extra logic.
Note the real issue is described and fixed in #336. In short - pending signal from previous test could cause an extra "spurious" initial callback at the start, now cleared at setup. |
On POSIX, call sigtimedwait() on the selected RT signal as part of the set up for the timebase. This ensures that if the signal is already pending, it will be cleared. This also simplifies the timer callback routine in the UT code, cleaning up some unncessary extra logic.
On POSIX, call sigtimedwait() on the selected RT signal as part of the set up for the timebase. This ensures that if the signal is already pending, it will be cleared. This also simplifies the timer callback routine in the UT code, cleaning up some unncessary extra logic.
Fix #335: Clear pending signal when configuring timer
Fix nasa#335: Shell unsigned pkt length bug
Describe the bug
osal_timer_UT periodically reports a failure on linux for the nominal OS_TimerSet case
To Reproduce
Expected behavior
Should pass
Code snips
See ut_ostimer_test.c for UT_os_timercallback (the timer callback function)
See ut_ostimer_timerio_test.c line 654 for the failure location
System observed on:
Additional context
Added after the tolerance check in the callback function:
failure result was seen due to unexpected first interval of 1056, where interval was set to 500000:
Reporter Info
Jacob Hageman - NASA/GSFC
The text was updated successfully, but these errors were encountered: