diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-01-14 08:42:51 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-01-14 08:42:51 +0100 |
commit | 29e8c99a7a028ba729bb0f910611efa13f94cd35 (patch) | |
tree | d66ead6075c9abd5acbe504665292cc9dd6c94dc | |
parent | 1bc864bfcdd7e57d3c049a1f5a8cd66c59c08b7a (diff) | |
parent | 8d28cc6894828fd49b909cbbd0bd9ce818f00176 (diff) | |
download | rsyslog-29e8c99a7a028ba729bb0f910611efa13f94cd35.tar.gz rsyslog-29e8c99a7a028ba729bb0f910611efa13f94cd35.tar.bz2 rsyslog-29e8c99a7a028ba729bb0f910611efa13f94cd35.zip |
Merge branch 'v7-stable-libnet-frag'
Conflicts:
ChangeLog
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | doc/debug.html | 5 | ||||
-rw-r--r-- | plugins/omelasticsearch/omelasticsearch.c | 2 | ||||
-rw-r--r-- | runtime/datetime.c | 4 | ||||
-rw-r--r-- | runtime/debug.c | 22 | ||||
-rw-r--r-- | runtime/debug.h | 1 | ||||
-rw-r--r-- | runtime/wtp.c | 1 | ||||
-rw-r--r-- | tests/tcpflood.c | 2 | ||||
-rw-r--r-- | threads.c | 4 |
10 files changed, 48 insertions, 6 deletions
@@ -4,6 +4,8 @@ Version 7.3.6 [devel] 2012-12-?? and avoid going through the syslog log stream. syslog logging can now also be turned off (see doc for details). - fix compile problem in imklog +- added capability to output thread-id-to-function debug info + This is a useful debug aid, but nothing of concern for regular users. --------------------------------------------------------------------------- Version 7.3.5 [devel] 2012-12-19 - ommysql: addded batching/transaction support @@ -133,6 +135,11 @@ Version 7.3.0 [devel] 2012-10-09 ---------------------------------------------------------------------------- Version 7.2.6 [v7-stable] 2013-01-?? - slightly improved config parser error messages when invalid escapes happen +- bugfix: omelasticsearch failed when authentication data was provided + ... at least in most cases it emitted an error message: + "snprintf failed when trying to build auth string" + Thanks to Joerg Heinemann for alerting us. + closes: http://bugzilla.adiscon.com/show_bug.cgi?id=404 - bugfix: some property-based filter were incorrectly parsed This usually lead to a syntax error on startup and rsyslogd not actually starting up. The problem was the regex, which did not care for double @@ -1153,6 +1160,8 @@ Version 5.10.2 [V5-STABLE], 201?-??-?? Thanks to Marius Tomaschewski for the bug report and the patch idea. - bugfix: invalid DST handling under Solaris Thanks to Scott Severtson for the patch. +- bugfix: invalid decrement in pm5424 could lead to log truncation + Thanks to Tomas Heinrich for the patch. - bugfix[kind of]: omudpspoof discarded messages >1472 bytes (MTU size) it now truncates these message, but ensures they are sent. Note that 7.3.5+ will switch to fragmented UDP messages instead (up to 64K) diff --git a/configure.ac b/configure.ac index 9835353a..eef88a64 100644 --- a/configure.ac +++ b/configure.ac @@ -114,7 +114,7 @@ AC_TYPE_SIGNAL AC_FUNC_STAT AC_FUNC_STRERROR_R AC_FUNC_VPRINTF -AC_CHECK_FUNCS([flock basename alarm clock_gettime getifaddrs gethostbyname gethostname gettimeofday localtime_r memset mkdir regcomp select setid socket strcasecmp strchr strdup strerror strndup strnlen strrchr strstr strtol strtoul uname ttyname_r getline malloc_trim prctl epoll_create epoll_create1 fdatasync lseek64]) +AC_CHECK_FUNCS([flock basename alarm clock_gettime getifaddrs gethostbyname gethostname gettimeofday localtime_r memset mkdir regcomp select setid socket strcasecmp strchr strdup strerror strndup strnlen strrchr strstr strtol strtoul uname ttyname_r getline malloc_trim prctl epoll_create epoll_create1 fdatasync syscall lseek64]) # the check below is probably ugly. If someone knows how to do it in a better way, please # let me know! -- rgerhards, 2010-10-06 @@ -146,7 +146,7 @@ RS_ATOMIC_OPERATIONS RS_ATOMIC_OPERATIONS_64BIT # fall back to POSIX sems for atomic operations (cpu expensive) -AC_CHECK_HEADERS([semaphore.h]) +AC_CHECK_HEADERS([semaphore.h sys/syscall.h]) # Additional module directories diff --git a/doc/debug.html b/doc/debug.html index 6aeb7975..8b104d80 100644 --- a/doc/debug.html +++ b/doc/debug.html @@ -49,6 +49,11 @@ FileTrace=vm.c FileTrace=expr.c"</li> <li><b>Debug</b> - if present, turns on the debug system and enables debug output <li><b>DebugOnDemand</b> - if present, turns on the debug system but does not enable debug output itself. You need to send SIGUSR1 to turn it on when desired. +<li><b>OutputTidToStderr</b> - if present, makes rsyslog output information about +the thread id (tid) of newly create processesto stderr. Note that not necessarily +all new threads are reported (depends on the code, e.g. of plugins). This is +only available under Linux. This usually does NOT work when privileges have +been dropped (that's not a bug, but the way it is). <li><b>help</b> - display a very short list of commands - hopefully a life saver if you can't access the documentation...</li> </ul> </ul> diff --git a/plugins/omelasticsearch/omelasticsearch.c b/plugins/omelasticsearch/omelasticsearch.c index 499a2bb2..f27fe62b 100644 --- a/plugins/omelasticsearch/omelasticsearch.c +++ b/plugins/omelasticsearch/omelasticsearch.c @@ -337,7 +337,7 @@ setCurlURL(instanceData *pData, uchar **tpls) if(pData->uid != NULL) { rLocal = snprintf(authBuf, sizeof(authBuf), "%s:%s", pData->uid, (pData->pwd == NULL) ? "" : (char*)pData->pwd); - if(rLocal != (int) es_strlen(url)) { + if(rLocal < 1) { errmsg.LogError(0, RS_RET_ERR, "omelasticsearch: snprintf failed " "when trying to build auth string (return %d)\n", rLocal); diff --git a/runtime/datetime.c b/runtime/datetime.c index 7d974471..e839bf10 100644 --- a/runtime/datetime.c +++ b/runtime/datetime.c @@ -305,8 +305,10 @@ ParseTIMESTAMP3339(struct syslogTime *pTime, uchar** ppszTS, int *pLenStr) if(OffsetHour < 0 || OffsetHour > 23) ABORT_FINALIZE(RS_RET_INVLD_TIME); - if(lenStr == 0 || *pszTS++ != ':') + if(lenStr == 0 || *pszTS != ':') ABORT_FINALIZE(RS_RET_INVLD_TIME); + --lenStr; + pszTS++; OffsetMinute = srSLMGParseInt32(&pszTS, &lenStr); if(OffsetMinute < 0 || OffsetMinute > 59) ABORT_FINALIZE(RS_RET_INVLD_TIME); diff --git a/runtime/debug.c b/runtime/debug.c index 1d306dbd..fa39e7fe 100644 --- a/runtime/debug.c +++ b/runtime/debug.c @@ -44,6 +44,9 @@ #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> +#ifdef HAVE_SYS_SYSCALL_H +# include <sys/syscall.h> +#endif #if _POSIX_TIMERS <= 0 #include <sys/time.h> #endif @@ -66,6 +69,7 @@ static int bPrintMutexAction = 0; /* shall mutex calls be printed to the debug l static int bPrintTime = 1; /* print a timestamp together with debug message */ static int bPrintAllDebugOnExit = 0; static int bAbortTrace = 1; /* print a trace after SIGABRT or SIGSEGV */ +static int bOutputTidToStderr = 0;/* output TID to stderr on thread creation */ static char *pszAltDbgFileName = NULL; /* if set, debug output is *also* sent to here */ static int altdbg = -1; /* and the handle for alternate debug output */ int stddbg = 1; /* the handle for regular debug output, set to stdout if not forking, -1 otherwise */ @@ -293,6 +297,21 @@ static inline void dbgFuncDBRemoveMutexLock(dbgFuncDB_t *pFuncDB, pthread_mutex_ /* ------------------------- END FuncDB utility functions ------------------------- */ +/* output the current thread ID to "relevant" places + * (what "relevant" means is determinded by various ways) + */ +void +dbgOutputTID(char* name) +{ +# ifdef HAVE_SYSCALL + if(bOutputTidToStderr) + fprintf(stderr, "thread tid %u, name '%s'\n", + (unsigned)syscall(SYS_gettid), name); + DBGPRINTF("thread created, tid %u, name '%s'\n", + (unsigned)syscall(SYS_gettid), name); +# endif +} + /* ########################################################################### * IMPORTANT NOTE * Mutex instrumentation reduces the code's concurrency and thus affects its @@ -1325,6 +1344,7 @@ dbgGetRuntimeOptions(void) "PrintAllDebugInfoOnExit (not yet implemented)\n" "NoLogTimestamp\n" "Nostdoout\n" + "OutputTidToStderr\n" "filetrace=file (may be provided multiple times)\n" "DebugOnDemand - enables debugging on USR1, but does not turn on output\n" "\nSee debug.html in your doc set or http://www.rsyslog.com for details\n"); @@ -1358,6 +1378,8 @@ dbgGetRuntimeOptions(void) stddbg = -1; } else if(!strcasecmp((char*)optname, "noaborttrace")) { bAbortTrace = 0; + } else if(!strcasecmp((char*)optname, "outputtidtostderr")) { + bOutputTidToStderr = 1; } else if(!strcasecmp((char*)optname, "filetrace")) { if(*optval == '\0') { fprintf(stderr, "rsyslogd " VERSION " error: logfile debug option requires filename, " diff --git a/runtime/debug.h b/runtime/debug.h index 5bd26bd8..f802e8c1 100644 --- a/runtime/debug.h +++ b/runtime/debug.h @@ -104,6 +104,7 @@ void dbgSetExecLocation(int iStackPtr, int line); void dbgSetThrdName(uchar *pszName); void dbgPrintAllDebugInfo(void); void *dbgmalloc(size_t size); +void dbgOutputTID(char* name); /* macros */ #ifdef DEBUGLESS diff --git a/runtime/wtp.c b/runtime/wtp.c index a53a9888..f8d3588b 100644 --- a/runtime/wtp.c +++ b/runtime/wtp.c @@ -383,6 +383,7 @@ wtpWorker(void *arg) /* the arg is actually a wti object, even though we are in } # endif + dbgOutputTID((char*)thrdName); pthread_cleanup_push(wtpWrkrExecCancelCleanup, pWti); wtiWorker(pWti); pthread_cleanup_pop(0); diff --git a/tests/tcpflood.c b/tests/tcpflood.c index db65b7de..b3cef2e0 100644 --- a/tests/tcpflood.c +++ b/tests/tcpflood.c @@ -347,7 +347,7 @@ genMsg(char *buf, size_t maxBuf, int *pLenBuf, struct instdata *inst) /* get message from file */ do { done = 1; - *pLenBuf = fread(buf, 1, 1024, dataFP); + *pLenBuf = fread(buf, 1, MAX_EXTRADATA_LEN + 1024, dataFP); if(*pLenBuf == 0) { if(--numFileIterations > 0) { rewind(dataFP); @@ -183,9 +183,11 @@ static void* thrdStarter(void *arg) assert(pThis != NULL); assert(pThis->pUsrThrdMain != NULL); + ustrncpy(thrdName+3, pThis->name, 20); + dbgOutputTID((char*)thrdName); + # if HAVE_PRCTL && defined PR_SET_NAME /* set thread name - we ignore if the call fails, has no harsh consequences... */ - ustrncpy(thrdName+3, pThis->name, 20); if(prctl(PR_SET_NAME, thrdName, 0, 0, 0) != 0) { DBGPRINTF("prctl failed, not setting thread name for '%s'\n", pThis->name); } else { |