diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2007-07-29 16:33:31 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2007-07-29 16:33:31 +0000 |
commit | ad0f7f7afa7d28cb285bfdb8c01d95ccfe03996b (patch) | |
tree | eccf878623202bdc72b30099e84da816825bad8d /syslogd.c | |
parent | 2b12abfef2b7ad57a367f1761c4b3ed93d398a1e (diff) | |
download | rsyslog-ad0f7f7afa7d28cb285bfdb8c01d95ccfe03996b.tar.gz rsyslog-ad0f7f7afa7d28cb285bfdb8c01d95ccfe03996b.tar.bz2 rsyslog-ad0f7f7afa7d28cb285bfdb8c01d95ccfe03996b.zip |
fixed a problem with shutting down the worker thread and freeing the
selector_t list - this caused messages to be lost, because the message
queue was not properly drained before the selectors got destroyed.
Diffstat (limited to 'syslogd.c')
-rw-r--r-- | syslogd.c | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -3308,9 +3308,9 @@ static void die(int sig) freeSelectors(); #ifdef USE_PTHREADS - stopWorker(); + /* Worker threads are stopped by freeSelectors() */ queueDelete(pMsgQueue); /* delete fifo here! */ - pMsgQueue = 0; + pMsgQueue = NULL; #endif /* now clean up the listener part */ @@ -3899,13 +3899,24 @@ static void freeSelectors(void) if(Files != NULL) { dprintf("Freeing log structures.\n"); + /* we need first to flush, then wait for all messages to be processed + * (stopWoker() does that), then we can free the structures. + */ f = Files; while (f != NULL) { /* flush any pending output */ if(f->f_prevcount) { fprintlog(f); } + f = f->f_next; + } + +# ifdef USE_PTHREADS + stopWorker(); +# endif + f = Files; + while (f != NULL) { /* free the action instances */ f->pMod->freeInstance(f->pModData); @@ -5228,9 +5239,7 @@ static void mainloop(void) } if(restart) { dprintf("\nReceived SIGHUP, reloading rsyslogd.\n"); -# ifdef USE_PTHREADS - stopWorker(); -# endif + /* worker thread is stopped as part of init() */ init(); # ifdef USE_PTHREADS startWorker(); |