> -----Original Message-----
> From: [email protected] [mailto:rsyslog-
> [email protected]] On Behalf Of Kaiwang Chen
> Sent: Tuesday, March 13, 2012 2:31 PM
> To: rsyslog-users
> Subject: Re: [rsyslog] lots of queue files left in working directory
> 
> 2012/3/13 Rainer Gerhards <[email protected]>:
> >> So I came to the conclusion that 16cc84 was not my case. In
> addition,
> >> I suppose the enforcement in 8d2f66 is not a good way to fix the
> >> problem about uninitialized counters. Callers of AddCounter() are
> >> supposed to call, if necessary, STATSCOUNTER_INIT precedingly to do
> >> initialization protected by mutex. The problems in new versions are
> >> that plugins/imptcp/imptcp.c, plugins/imudp/imudp.c and tcpsrv.c
> miss
> >> the call of STATSCOUNTER_INIT, while action.c,
> >> plugins/imuxsock/imuxsock.c,
> >> plugins/omelasticsearch/omelasticsearch.c, runtime/queue.c are OK.
> The
> >> enforcement coexisting with STATSCOUNTER_INIT is confusing, and not
> >> documented as well.
> >
> > Thanks again for the analysis. I guess the interface was not well
> done in the
> > first place, as obviously even I misused it after a couple of weeks.
> I think
> > I will change it so that AddCounter() will receive an additional
> parameter
> > which tells if init is required or not. That should prevent further
> > confusion. Any comments on that?
> 
> STATSCOUNTER_INIT takes a mutex as well, will you consider that? Then
> it requires two additional parameters.

Thanks again - I am right now at the exact same question and have done some
review of why I created it the way it was. The mutex is only present if
atomic operations are not used. The macros take care of that and that was
probably the root reason to use them. As this is a quite efficient method, I
have shifted my thoughts to keep the macros. On the other hand, this probably
means things like the iQueueSize do not have the macros associated, and their
use depends on some non-obvious things. Which is bad. On the other hand, it
is also bad to carry around mutexes that are never used.

Not sure if better doc inside the code could help with that. What do you
mean?

Rainer 
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/

Reply via email to