diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | plugins/imudp/imudp.c | 6 | ||||
-rw-r--r-- | threads.c | 5 |
3 files changed, 18 insertions, 5 deletions
@@ -3,6 +3,18 @@ Version 5.3.1 [DEVEL] (rgerhards), 2009-10-05 - added $AbortOnUncleanConfig directive - permits to prevent startup when there are problems with the configuration file. See it's doc for details. +- re-enabled input thread termination handling that does avoid thread + cancellation where possible. This provides a more reliable mode of + rsyslogd termination (canceling threads my result in not properly + freed resouces and potential later hangs, even though we perform + proper cancel handling in our code). This is part of an effort to + reduce thread cnacellation as much as possible in rsyslog. + NOTE: some comments indicated that there were problems with some code + that has been re-activated. Testing did not show any issues. My current + assumption is that these issues were related to some other code that + has been removed/changed during the previous restructuring events. + In any case, if there is a shutdown issue, one should carefully look + at this change here! - some cleanup/slight improvement: * changed imuxsock to no longer use deprecated submitAndParseMsg() IF * changed submitAndParseMsg() interface to be a wrapper around the new diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c index 735042a4..a1484e7f 100644 --- a/plugins/imudp/imudp.c +++ b/plugins/imudp/imudp.c @@ -336,6 +336,9 @@ rsRetVal rcvMainLoop() nfds = epoll_wait(efd, currEvt, NUM_EPOLL_EVENTS, -1); DBGPRINTF("imudp: epoll_wait() returned with %d fds\n", nfds); + if(glbl.GetGlobalInputTermState() == 1) + break; /* terminate input! */ + for(i = 0 ; i < nfds ; ++i) { processSocket(currEvt[i].data.fd, &frominetPrev, &bIsPermitted, fromHost, fromHostFQDN, fromHostIP); @@ -343,6 +346,9 @@ rsRetVal rcvMainLoop() } finalize_it: + if(udpEPollEvt != NULL) + free(udpEPollEvt); + RETiRet; } #else /* #if HAVE_EPOLL_CREATE1 */ @@ -92,19 +92,14 @@ rsRetVal thrdTerminate(thrdInfo_t *pThis) DEFiRet; assert(pThis != NULL); -#if 0 // TODO: somehow does not really work yet! if(pThis->bNeedsCancel) { -#endif DBGPRINTF("request term via canceling for input thread 0x%x\n", (unsigned) pThis->thrdID); pthread_cancel(pThis->thrdID); -#if 0 // TODO: somehow does not really work yet! - if(pThis->bNeedsCancel) { } else { DBGPRINTF("request term via SIGTTIN for input thread 0x%x\n", (unsigned) pThis->thrdID); pthread_kill(pThis->thrdID, SIGTTIN); } -#endif pthread_join(pThis->thrdID, NULL); /* wait for input thread to complete */ pThis->bIsActive = 0; |