[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rrd-developers
Subject:    Re: [rrd-developers] [PATCH] [BUG] fixed hang in flush_file()
From:       Tobias Oetiker <tobi () oetiker ! ch>
Date:       2008-09-28 19:21:21
Message-ID: alpine.DEB.1.99.0809282118040.10549 () sebohet ! brgvxre ! pu
[Download RAW message or body]

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@oetiker.ch ++41 62 775 9902 / sb: -9900

_______________________________________________
rrd-developers mailing list
rrd-developers@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic