RE: [chrony-dev] makestep command sometimes makes chrony stop reading its sources

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


>>I'm now working on a patch for the stepping.
>>
>>stepclock 0.5 5
>>
>>in chrony.conf will allow to step the clock when offset update is
>>larger than 0.5 second, but only in first five updates.
>>
>>
>
>Unfortunately the new makestep command does not work for me when the
>initial offset
>is in the future. The system clock is stepped to the correct time as
>soon as chrony
>locks in on the SHM reference time, but right after it freezes again
>with 100% cpu
>load. I used the "makestep 10 -1" line in my chrony.conf file.
>
>When the initial offset is in the past it works fine. I do not need my
>own script
>anymore to issue a "makestep" command using chronyc.
>

After executing some tests I found out that the scheduler goes berserk
when the LCL_MakeStep function steps the system time back into the
past. The poll_timeout function in refclock.c schedules a new timeout
before it returns, and because the scheduler still acts in the
future in the dispatch_timeouts function it keeps calling the
poll_timeout function. To prevent this to happen I've replaced the
"while" statement on line 444 of sched.c with "if" so that it is
only executed once. The while loop in SCH_MainLoop, line 546-547
will take care of any successive elements, but the current "now"
time is updated to the newly set system time after each execution
run.

The patch file I've used to fix this is:

--- a/sched.c
+++ b/sched.c
@@ -440,7 +440,7 @@ dispatch_timeouts(struct timeval *now)
   TimerQueueEntry *ptr;
   int n_done = 0;
 
-  while ((n_timer_queue_entries > 0) &&
+  if ((n_timer_queue_entries > 0) &&
          (UTI_CompareTimevals(now, &(timer_queue.next->tv)) >= 0)) {
     ptr = timer_queue.next;
 

 
Maybe this is not the most elegant solution, so please take a good
look at it.

--
Tjalling Hattink

---
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/