[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [hobbit] hobbit-client: segfault on several systems
- To: hobbit (at) hswn.dk
- Subject: Re: [hobbit] hobbit-client: segfault on several systems
- From: Henrik Stoerner <henrik (at) hswn.dk>
- Date: Mon, 28 Jan 2008 13:09:14 +0100
- References: <801824066.20080126115102 (at) alexkeller.de>
- User-agent: Mutt/1.5.15+20070412 (2007-04-11)
On Sat, Jan 26, 2008 at 11:51:02AM +0100, Alexander Keller wrote:
> But yesterday a somehow strange error occured. About 15 hobbit clients
> suddenly died (all at the same time! +/- 5min) They all wrote a
> core file.
[snip]
> Core was generated by `/opt/hobbit/client/bin/hobbitlaunch --config=/opt/hobbit/client/etc/clientlaunc'.
> Program terminated with signal 11, Segmentation fault.
> (gdb) bt
> #0 errprintf (fmt=0x805507c "Time warp detected: Adjusting returned clock by %d seconds\n") at errormsg.c:42
> #1 0x08050c8e in getcurrenttime (retparm=0x0) at timefunc.c:55
> #2 0x0804c10b in errprintf (fmt=0x805507c "Time warp detected: Adjusting returned clock by %d seconds\n") at errormsg.c:42
> #3 0x08050c8e in getcurrenttime (retparm=0x0) at timefunc.c:55
> #4 0x0804c10b in errprintf (fmt=0x805507c "Time warp detected: Adjusting returned clock by %d seconds\n") at errormsg.c:42
hobbitlaunch ended up doing an endless recursion, thereby filling up the
stack and crashing.
It was caused by the clock on your boxes suddenly being set back.
Normally, time cannot go backwards (unless your systems are moving
faster than light, which - according to Einstein - is impossible).
Hobbit detects when it happens, but couldn't quite handle it.
I've attached a patch that should prevent this from happening again.
Regards,
Henrik
--- lib/timefunc.c 2008/01/03 09:59:13 1.38
+++ lib/timefunc.c 2008/01/28 12:05:15
@@ -35,6 +35,7 @@
static time_t firsttime = 0;
static time_t lastresult = 0;
time_t now, result;
+ int timewarphappened = 0;
result = now = time(NULL);
@@ -52,7 +53,7 @@
* back in time.
*/
timewarp = (lastresult - result);
- errprintf("Time warp detected: Adjusting returned clock by %d seconds\n", timewarp);
+ timewarphappened = 1;
}
result += timewarp;
@@ -61,6 +62,17 @@
lastresult = result;
if (retparm) *retparm = result;
+
+ if (timewarphappened) {
+ /*
+ * Tell the world about it.
+ * Must do this AFTER changing timewarp and lastresult,
+ * or we will start an endless loop triggering a stack
+ * overflow because errprintf() calls getcurrenttime().
+ */
+ errprintf("Time warp detected: Adjusting returned clock by %d seconds\n", timewarp);
+ }
+
return result;
}