From e91ea6c235b9972fe0bb132608278bc45ca65c00 Mon Sep 17 00:00:00 2001 From: ckolivas Date: Sat, 17 Jan 2015 17:25:48 +1100 Subject: [PATCH] Add sanity breakout of worker instance looping in statsupdate --- src/stratifier.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/stratifier.c b/src/stratifier.c index b0351cba..c3f795c6 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -3513,10 +3513,18 @@ static void *statsupdate(void *arg) HASH_ITER(hh, sdata->user_instances, instance, tmpuser) { worker_instance_t *worker; + int iterations = 0; bool idle = false; /* Decay times per worker */ DL_FOREACH(instance->worker_instances, worker) { + /* FIXME: This shouldn't happen and is purely a sanity + * breakout till the real issue is found fixed. */ + if (unlikely(iterations++ > instance->workers)) { + LOGWARNING("Statsupdate trying to iterate more than %d existing workers for worker %s", + instance->workers, worker->workername); + break; + } per_tdiff = tvdiff(&now, &worker->last_share); if (per_tdiff > 60) { decay_time(&worker->dsps1, 0, per_tdiff, 60);