The Samba-Bugzilla – Bug 9789
rsync hangs when NTP update system clock time
Last modified: 2013-05-19 22:55:05 UTC
There is a periodic rsync which runs in my system every 1 min. When system is coming up, NTP update the time and if at the same moment this periodic rsync executes, then it gets hanged. Following was the output after running strace on rsync:
After going through the code of rsync it looks like there is problem in msleep function. It uses gettimeofday linux API. If system clock time changes between two successive calls to this function then the time difference will be a very large value which is getting assigned to a 32bit signed integer variable tdiff. Since that time difference is larger than 2^31, tdiff finally gets a large negative number.
this number is passed as positive value in the select call used for sleeping.
Thus ultimately leading to rsync hang for a very large amount of time.
In my case it hanged for 550hrs. I tried to assigned NTP time reset value in ms to a 32-bit signed int variable, and it is coming around 550hrs.
I just wanted to know has this issue been fix in higher versions or not, and if fixed, then which version.
Many thanks in advance.
Looks like nobody is taking care of this bugzilla
still got no response even after so many days of posting the comment
I'm checking in a change to the msleep() function that will ensure that a backward movement in time doesn't generate a huge sleep. These 2 new lines are being added after the call to gettimeofday(&t2, NULL):
+ if (t2.tv_sec < t1.tv_sec)
+ t1 = t2; /* Time went backwards, so start over. */
This fix will be released in 3.1.0.