[rrd-developers] [PATCH] [BUG] fixed hang in flush_file() introduced by per-file flush condition

Tobias Oetiker tobi at oetiker.ch
Sun Sep 28 21:21:21 CEST 2008


Hi Kevin,

this patch did not apply ... the Enqueue at head part does not
exist in the svn version of the daemon.

cheers
tobi
Friday kevin brintnall wrote:

> A RRD file with no values would not be enqueued, so it would never be
> flushed.  Therefore, its "flushed" condition would never be broadcast.
> Therefore, a "flush" issued against a file with no updates would block
> until the file was written to disk for another reason (i.e. periodic
> timer, flush after update, etc).
>
> If we have no values, do not try to enqueue the RRD, and do not block
> waiting for it to be flushed.
> ---
>  src/rrd_daemon.c |   12 +++++++-----
>  1 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c
> index d6f77eb..36d090c 100644
> --- a/src/rrd_daemon.c
> +++ b/src/rrd_daemon.c
> @@ -745,12 +745,14 @@ static int flush_file (const char *filename) /* {{{ */
>      return (ENOENT);
>    }
>
> -  /* Enqueue at head */
> -  enqueue_cache_item (ci, HEAD);
> -  pthread_cond_signal (&cache_cond);
> +  if (ci->values > 0)
> +  {
> +    /* Enqueue at head */
> +    enqueue_cache_item (ci, HEAD);
> +    pthread_cond_signal (&cache_cond);
> +    pthread_cond_wait(&ci->flushed, &cache_lock);
> +  }
>
> -  pthread_cond_wait(&ci->flushed, &cache_lock);
> -  assert((ci->flags & CI_FLAGS_IN_QUEUE) == 0);
>    pthread_mutex_unlock(&cache_lock);
>
>    return (0);
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900



More information about the rrd-developers mailing list