From 009738a0ac6ba0dccf403f9e396095f44e4f9ac6 Mon Sep 17 00:00:00 2001
From: Naoya Nakazawa
Date: Mon, 11 Jan 2010 12:34:46 +0100
Subject: fixed a memory leak when sending messages in zip-compressed format
Signed-off-by: Rainer Gerhards
---
ChangeLog | 2 ++
tools/omfwd.c | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 0f8037ff..ad94566d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+- fixed a memory leak when sending messages in zip-compressed format
+ Thanks to Naoya Nakazawa for analyzing this issue and providing a patch.
---------------------------------------------------------------------------
Version 4.5.7 [v4-beta] (rgerhards), 2009-11-18
- added a so-called "On Demand Debug" mode, in which debug output can
diff --git a/tools/omfwd.c b/tools/omfwd.c
index fe65f515..02f19eac 100644
--- a/tools/omfwd.c
+++ b/tools/omfwd.c
@@ -483,6 +483,12 @@ CODESTARTdoAction
}
}
finalize_it:
+# ifdef USE_NETZIP
+ if(psz != (char*) ppString[0]) {
+ /* we need to free temporary buffer, alloced above - Naoya Nakazawa, 2010-01-11 */
+ free(psz);
+ }
+# endif
ENDdoAction
--
cgit
From 3cb29f4e2b3053eaa3e2487161fc03fa730f5104 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Tue, 12 Jan 2010 12:45:42 +0100
Subject: doc bugfix: "-h" option no longer exists
---
doc/rsyslog_conf_actions.html | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/doc/rsyslog_conf_actions.html b/doc/rsyslog_conf_actions.html
index 2ef3f4b0..8c4b9cfc 100644
--- a/doc/rsyslog_conf_actions.html
+++ b/doc/rsyslog_conf_actions.html
@@ -98,18 +98,14 @@ done, same with /dev/console.
messages to a remote host running rsyslogd(8) and to receive messages
from remote hosts. Using this feature you're able to control all syslog
messages on one host, if all other machines will log remotely to that.
-This tears down
-administration needs.
-
-Please note that this version of rsyslogd by default does NOT
-forward messages it has received from the network to another host.
-Specify the "-h" option to enable this.
+This tears down administration needs.
To forward messages to another host, prepend the hostname with
the at sign ("@"). A single at sign means that messages will
be forwarded via UDP protocol (the standard for syslog). If you prepend
two at signs ("@@"), the messages will be transmitted via TCP. Please
note that plain TCP based syslog is not officially standardized, but
-most major syslogds support it (e.g. syslog-ng or WinSyslog). The
+most major syslogds support it (e.g. syslog-ng or
+WinSyslog). The
forwarding action indicator (at-sign) can be followed by one or more
options. If they are given, they must be immediately (without a space)
following the final at sign and be enclosed in parenthesis. The
--
cgit
From 5b4e06fc28ef217e9ca26611e11afd974bdd1a4a Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Fri, 15 Jan 2010 17:01:10 +0100
Subject: bugfix: rsyslog hangs when writing to a named pipe which nobody was
reading.
Thanks to Michael Biebl for reporting this bug.
---
ChangeLog | 6 +++++-
runtime/stream.c | 13 ++++++++++---
runtime/stream.h | 3 ++-
tools/omfile.c | 22 ++++++++++++++++------
4 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ad94566d..c58d5b78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
-- fixed a memory leak when sending messages in zip-compressed format
+---------------------------------------------------------------------------
+Version 4.5.8 [v4-beta] (rgerhards), 2010-01-??
+- bugfix: rsyslog hang when writing to a named pipe which nobody was
+ reading. Thanks to Michael Biebl for reporting this bug.
+- bugfix: memory leak when sending messages in zip-compressed format
Thanks to Naoya Nakazawa for analyzing this issue and providing a patch.
---------------------------------------------------------------------------
Version 4.5.7 [v4-beta] (rgerhards), 2009-11-18
diff --git a/runtime/stream.c b/runtime/stream.c
index 2d1e9380..36f44003 100644
--- a/runtime/stream.c
+++ b/runtime/stream.c
@@ -209,13 +209,19 @@ doPhysOpen(strm_t *pThis)
default:assert(0);
break;
}
+ if(pThis->sType == STREAMTYPE_NAMED_PIPE) {
+ DBGPRINTF("Note: stream '%s' is a named pipe, open with O_NONBLOCK\n", pThis->pszCurrFName);
+ iFlags |= O_NONBLOCK;
+ }
pThis->fd = open((char*)pThis->pszCurrFName, iFlags, pThis->tOpenMode);
DBGPRINTF("file '%s' opened as #%d with mode %d\n", pThis->pszCurrFName, pThis->fd, pThis->tOpenMode);
if(pThis->fd == -1) {
- int ierrnoSave = errno;
- dbgoprint((obj_t*) pThis, "open error %d, file '%s'\n", errno, pThis->pszCurrFName);
- if(ierrnoSave == ENOENT)
+ char errStr[1024];
+ int err = errno;
+ rs_strerror_r(err, errStr, sizeof(errStr));
+ dbgoprint((obj_t*) pThis, "open error %d, file '%s': %s\n", errno, pThis->pszCurrFName, errStr);
+ if(err == ENOENT)
ABORT_FINALIZE(RS_RET_FILE_NOT_FOUND);
else
ABORT_FINALIZE(RS_RET_IO_ERROR);
@@ -429,6 +435,7 @@ strmHandleEOF(strm_t *pThis)
ISOBJ_TYPE_assert(pThis, strm);
switch(pThis->sType) {
case STREAMTYPE_FILE_SINGLE:
+ case STREAMTYPE_NAMED_PIPE:
ABORT_FINALIZE(RS_RET_EOF);
break;
case STREAMTYPE_FILE_CIRCULAR:
diff --git a/runtime/stream.h b/runtime/stream.h
index 64ffb6e1..89175b0f 100644
--- a/runtime/stream.h
+++ b/runtime/stream.h
@@ -76,7 +76,8 @@
typedef enum {
STREAMTYPE_FILE_SINGLE = 0, /**< read a single file */
STREAMTYPE_FILE_CIRCULAR = 1, /**< circular files */
- STREAMTYPE_FILE_MONITOR = 2 /**< monitor a (third-party) file */
+ STREAMTYPE_FILE_MONITOR = 2, /**< monitor a (third-party) file */
+ STREAMTYPE_NAMED_PIPE = 3 /**< file is a named pipe (so far, tested for output only) */
} strmType_t;
typedef enum { /* when extending, do NOT change existing modes! */
diff --git a/tools/omfile.c b/tools/omfile.c
index 209adc51..db49a05c 100644
--- a/tools/omfile.c
+++ b/tools/omfile.c
@@ -109,6 +109,7 @@ static uchar *pszTplName = NULL; /* name of the default template to use */
typedef struct _instanceData {
uchar f_fname[MAXFNAME];/* file or template name (display only) */
strm_t *pStrm; /* our output stream */
+ strmType_t strmType; /* stream type, used for named pipes */
char bDynamicName; /* 0 - static name, 1 - dynamic name (with properties) */
int fCreateMode; /* file creation mode for open() */
int fDirCreateMode; /* creation mode for mkdir() */
@@ -405,7 +406,7 @@ prepareFile(instanceData *pData, uchar *newFileName)
CHKiRet(strm.SettOperationsMode(pData->pStrm, STREAMMODE_WRITE_APPEND));
CHKiRet(strm.SettOpenMode(pData->pStrm, fCreateMode));
CHKiRet(strm.SetbSync(pData->pStrm, pData->bSyncFile));
- CHKiRet(strm.SetsType(pData->pStrm, STREAMTYPE_FILE_SINGLE));
+ CHKiRet(strm.SetsType(pData->pStrm, pData->strmType));
CHKiRet(strm.SetiSizeLimit(pData->pStrm, pData->iSizeLimit));
/* set the flush interval only if we actually use it - otherwise it will activate
* async processing, which is a real performance waste if we do not do buffered
@@ -576,8 +577,11 @@ writeFile(uchar **ppString, unsigned iMsgOpts, instanceData *pData)
finalize_it:
if(iRet != RS_RET_OK) {
- /* in v5, we shall return different states for message-cause failur (but only there!) */
- iRet = RS_RET_SUSPENDED;
+ /* in v5, we shall return different states for message-caused failure (but only there!) */
+ if(pData->strmType == STREAMTYPE_NAMED_PIPE)
+ iRet = RS_RET_DISABLE_ACTION; /* this is the traditional semantic -- rgerhards, 2010-01-15 */
+ else
+ iRet = RS_RET_SUSPENDED;
}
RETiRet;
}
@@ -665,11 +669,17 @@ CODESTARTparseSelectorAct
case '|':
case '/':
CODE_STD_STRING_REQUESTparseSelectorAct(1)
- /* we now have the same semantics for files and pipes, but we need to skip over
- * the pipe indicator traditionally seen in config files...
+ /* we now have *almost* the same semantics for files and pipes, but we still need
+ * to know we deal with a pipe, because we must do non-blocking opens in that case
+ * (to keep consistent with traditional semantics and prevent rsyslog from hanging).
*/
- if(*p == '|')
+ if(*p == '|') {
++p;
+ pData->strmType = STREAMTYPE_NAMED_PIPE;
+ } else {
+ pData->strmType = STREAMTYPE_FILE_SINGLE;
+ }
+
CHKiRet(cflineParseFileName(p, (uchar*) pData->f_fname, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS,
(pszTplName == NULL) ? (uchar*)"RSYSLOG_FileFormat" : pszTplName));
pData->bDynamicName = 0;
--
cgit
From 112b69d983a27a98eacb0d2f90efef287e24a82f Mon Sep 17 00:00:00 2001
From: Michael Biebl
Date: Tue, 19 Jan 2010 14:39:24 +0100
Subject: Fix a typo regarding syslog.h and syslog(3)
Signed-off-by: Rainer Gerhards
---
doc/rsyslog_conf_filter.html | 4 ++--
tools/rsyslog.conf.5 | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/doc/rsyslog_conf_filter.html b/doc/rsyslog_conf_filter.html
index 1d30d8ae..841ec9c7 100644
--- a/doc/rsyslog_conf_filter.html
+++ b/doc/rsyslog_conf_filter.html
@@ -48,8 +48,8 @@ in rsyslog and offer the best performance for this job.
facility and a priority, separated by a period (".''). Both parts are
case insensitive and can also be specified as decimal numbers, but
don't do that, you have been warned. Both facilities and priorities are
-described in rsyslog(3). The names mentioned below correspond to the
-similar LOG_-values in /usr/include/rsyslog.h.
+described in syslog(3). The names mentioned below correspond to the
+similar LOG_-values in /usr/include/syslog.h.
The facility is one of the following keywords: auth, authpriv, cron,
daemon, kern, lpr, mail, mark, news, security (same as auth), syslog,
diff --git a/tools/rsyslog.conf.5 b/tools/rsyslog.conf.5
index 0a2422c6..f2b915e2 100644
--- a/tools/rsyslog.conf.5
+++ b/tools/rsyslog.conf.5
@@ -164,8 +164,8 @@ a pattern of facilities and priorities belonging to the specified action.
The selector field itself again consists of two parts, a facility and a
priority, separated by a period ('.'). Both parts are case insensitive and can
also be specified as decimal numbers, but don't do that, you have been warned.
-Both facilities and priorities are described in rsyslog(3). The names mentioned
-below correspond to the similar LOG_-values in /usr/include/rsyslog.h.
+Both facilities and priorities are described in syslog(3). The names mentioned
+below correspond to the similar LOG_-values in /usr/include/syslog.h.
The facility is one of the following keywords: auth, authpriv, cron, daemon,
kern, lpr, mail, mark, news, security (same as auth), syslog, user, uucp and
--
cgit
From 9cfa072caa0ba1863c89ae6b41d1c5838b9a42b0 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Tue, 19 Jan 2010 15:15:22 +0100
Subject: bugfix: blanks inside file names did not terminate file name parsing.
This could reslult in the whole rest of a line (including comments)
to be treated as file name in "write to file" actions.
Thanks to Jack for reporting this issue.
---
ChangeLog | 4 ++++
runtime/conf.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index c58d5b78..837b1cb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
---------------------------------------------------------------------------
Version 4.5.8 [v4-beta] (rgerhards), 2010-01-??
+- bugfix: blanks inside file names did not terminate file name parsing.
+ This could reslult in the whole rest of a line (including comments)
+ to be treated as file name in "write to file" actions.
+ Thanks to Jack for reporting this issue.
- bugfix: rsyslog hang when writing to a named pipe which nobody was
reading. Thanks to Michael Biebl for reporting this bug.
- bugfix: memory leak when sending messages in zip-compressed format
diff --git a/runtime/conf.c b/runtime/conf.c
index 83ed2e9b..b92664a1 100644
--- a/runtime/conf.c
+++ b/runtime/conf.c
@@ -568,6 +568,7 @@ finalize_it:
* rgerhards, 2007-07-25
* updated to include OMSR pointer -- rgerhards, 2007-07-27
* updated to include template name -- rgerhards, 2008-03-28
+ * rgerhards, 2010-01-19: file names end at the first space
*/
rsRetVal
cflineParseFileName(uchar* p, uchar *pFileName, omodStringRequest_t *pOMSR, int iEntry, int iTplOpts, uchar *pszTpl)
@@ -580,7 +581,7 @@ cflineParseFileName(uchar* p, uchar *pFileName, omodStringRequest_t *pOMSR, int
pName = pFileName;
i = 1; /* we start at 1 so that we reseve space for the '\0'! */
- while(*p && *p != ';' && i < MAXFNAME) {
+ while(*p && *p != ';' && *p != ' ' && i < MAXFNAME) {
*pName++ = *p++;
++i;
}
--
cgit
From bd03b86c6322c82fc9f667122f4365e339f28ccc Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Tue, 19 Jan 2010 15:49:26 +0100
Subject: bugfix: -d did not enable display of debug messages
regression from introduction of "debug on demand" mode
Thanks to Michael Biebl for reporting this bug
---
ChangeLog | 3 +++
tools/syslogd.c | 1 +
2 files changed, 4 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 837b1cb4..29383818 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
---------------------------------------------------------------------------
Version 4.5.8 [v4-beta] (rgerhards), 2010-01-??
+- bugfix: -d did not enable display of debug messages
+ regression from introduction of "debug on demand" mode
+ Thanks to Michael Biebl for reporting this bug
- bugfix: blanks inside file names did not terminate file name parsing.
This could reslult in the whole rest of a line (including comments)
to be treated as file name in "write to file" actions.
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 3dd51adf..ab8f015d 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -3203,6 +3203,7 @@ int realMain(int argc, char **argv)
iCompatibilityMode = atoi(optarg);
break;
case 'd': /* debug - must be handled now, so that debug is active during init! */
+ debugging_on = 1;
Debug = 1;
break;
case 'e': /* log every message (no repeat message supression) */
--
cgit
From ca8884d85d4ca35ebc8f410f78716ddb46ad86bb Mon Sep 17 00:00:00 2001
From: varmojfekoj
Date: Tue, 26 Jan 2010 11:30:06 +0100
Subject: bugfixes for potential segfaults during queue shutdown
(bugs require certain non-standard settings to appear)
Signed-off-by: Rainer Gerhards
---
runtime/queue.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/runtime/queue.c b/runtime/queue.c
index 4e017e84..18418df0 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -853,9 +853,11 @@ static rsRetVal qDestructDisk(qqueue_t *pThis)
DEFiRet;
ASSERT(pThis != NULL);
-
- strmDestruct(&pThis->tVars.disk.pWrite);
- strmDestruct(&pThis->tVars.disk.pRead);
+
+ if (pThis->tVars.disk.pWrite != NULL)
+ strmDestruct(&pThis->tVars.disk.pWrite);
+ if (pThis->tVars.disk.pRead != NULL)
+ strmDestruct(&pThis->tVars.disk.pRead);
RETiRet;
}
@@ -1209,7 +1211,7 @@ static rsRetVal qqueueShutdownWorkers(qqueue_t *pThis)
/* we need to re-aquire the mutex for the next check in this case! */
BEGIN_MTX_PROTECTED_OPERATIONS(pThis->mut, LOCK_MUTEX); /* some workers may be running in parallel! */
}
- if(pThis->bIsDA && wtpGetCurNumWrkr(pThis->pWtpDA, LOCK_MUTEX) > 0) {
+ if(pThis->bRunsDA && wtpGetCurNumWrkr(pThis->pWtpDA, LOCK_MUTEX) > 0) {
/* and now the same for the DA queue */
END_MTX_PROTECTED_OPERATIONS(pThis->mut);
dbgoprint((obj_t*) pThis, "trying immediate shutdown of DA workers\n");
@@ -1662,7 +1664,7 @@ qqueueChkStopWrkrDA(qqueue_t *pThis)
if(pThis->bEnqOnly) {
bStopWrkr = 1;
} else {
- if(pThis->bRunsDA) {
+ if(pThis->bRunsDA == 2) {
ASSERT(pThis->pqDA != NULL);
if( pThis->pqDA->bEnqOnly
&& pThis->pqDA->sizeOnDiskMax > 0
@@ -1917,7 +1919,8 @@ static rsRetVal qqueuePersist(qqueue_t *pThis, int bIsCheckpoint)
pThis->bNeedDelQIF = 0;
}
/* indicate spool file needs to be deleted */
- CHKiRet(strmSetbDeleteOnClose(pThis->tVars.disk.pRead, 1));
+ if (pThis->tVars.disk.pRead != NULL)
+ CHKiRet(strmSetbDeleteOnClose(pThis->tVars.disk.pRead, 1));
FINALIZE; /* nothing left to do, so be happy */
}
@@ -1951,13 +1954,15 @@ static rsRetVal qqueuePersist(qqueue_t *pThis, int bIsCheckpoint)
}
/* now persist the stream info */
- CHKiRet(strmSerialize(pThis->tVars.disk.pWrite, psQIF));
- CHKiRet(strmSerialize(pThis->tVars.disk.pRead, psQIF));
+ if (pThis->tVars.disk.pWrite != NULL)
+ CHKiRet(strmSerialize(pThis->tVars.disk.pWrite, psQIF));
+ if (pThis->tVars.disk.pRead != NULL)
+ CHKiRet(strmSerialize(pThis->tVars.disk.pRead, psQIF));
/* tell the input file object that it must not delete the file on close if the queue
* is non-empty - but only if we are not during a simple checkpoint
*/
- if(bIsCheckpoint != QUEUE_CHECKPOINT) {
+ if(bIsCheckpoint != QUEUE_CHECKPOINT && pThis->tVars.disk.pRead != NULL) {
CHKiRet(strmSetbDeleteOnClose(pThis->tVars.disk.pRead, 0));
}
--
cgit
From 8a3a6f4deb76218f24e79380db30904eef1feded Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Tue, 26 Jan 2010 11:38:21 +0100
Subject: did some adoptions necessary to use the bugfix with v4-beta code base
---
runtime/queue.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/runtime/queue.c b/runtime/queue.c
index 33fb4c0f..9d7a9058 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -860,9 +860,9 @@ static rsRetVal qDestructDisk(qqueue_t *pThis)
ASSERT(pThis != NULL);
if (pThis->tVars.disk.pWrite != NULL)
- strmDestruct(&pThis->tVars.disk.pWrite);
+ strm.Destruct(&pThis->tVars.disk.pWrite);
if (pThis->tVars.disk.pRead != NULL)
- strmDestruct(&pThis->tVars.disk.pRead);
+ strm.Destruct(&pThis->tVars.disk.pRead);
RETiRet;
}
@@ -1924,7 +1924,7 @@ static rsRetVal qqueuePersist(qqueue_t *pThis, int bIsCheckpoint)
}
/* indicate spool file needs to be deleted */
if (pThis->tVars.disk.pRead != NULL)
- CHKiRet(strmSetbDeleteOnClose(pThis->tVars.disk.pRead, 1));
+ CHKiRet(strm.SetbDeleteOnClose(pThis->tVars.disk.pRead, 1));
FINALIZE; /* nothing left to do, so be happy */
}
@@ -1959,15 +1959,15 @@ static rsRetVal qqueuePersist(qqueue_t *pThis, int bIsCheckpoint)
/* now persist the stream info */
if (pThis->tVars.disk.pWrite != NULL)
- CHKiRet(strmSerialize(pThis->tVars.disk.pWrite, psQIF));
+ CHKiRet(strm.Serialize(pThis->tVars.disk.pWrite, psQIF));
if (pThis->tVars.disk.pRead != NULL)
- CHKiRet(strmSerialize(pThis->tVars.disk.pRead, psQIF));
+ CHKiRet(strm.Serialize(pThis->tVars.disk.pRead, psQIF));
/* tell the input file object that it must not delete the file on close if the queue
* is non-empty - but only if we are not during a simple checkpoint
*/
if(bIsCheckpoint != QUEUE_CHECKPOINT && pThis->tVars.disk.pRead != NULL) {
- CHKiRet(strmSetbDeleteOnClose(pThis->tVars.disk.pRead, 0));
+ CHKiRet(strm.SetbDeleteOnClose(pThis->tVars.disk.pRead, 0));
}
/* we have persisted the queue object. So whenever it comes to an empty queue,
--
cgit
From 7d098f14cba4f31dec7d92136183ebd0ccf7e1d0 Mon Sep 17 00:00:00 2001
From: varmojfekoj
Date: Tue, 26 Jan 2010 11:54:33 +0100
Subject: bugfix: potential segfault on queue shutdown
Signed-off-by: Rainer Gerhards
---
ChangeLog | 2 ++
runtime/queue.c | 23 ++++++++++++++---------
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 116a2ce6..33ae5ad6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,8 @@ Version 4.4.3 [v4-stable] (rgerhards), 2009-10-??
This was a regression from the time() optimizations done in v4.
Bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=143
Thanks to Klaus Tachtler for reporting this bug.
+- bugfix: potential segfault on queue shutdown
+ Thanks to varmojfekoj for the patch.
- bugfix: potential hang condition on queue shutdown
[imported from v3-stable]
- bugfix: segfault on startup when -q or -Q option was given
diff --git a/runtime/queue.c b/runtime/queue.c
index 4e017e84..18418df0 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -853,9 +853,11 @@ static rsRetVal qDestructDisk(qqueue_t *pThis)
DEFiRet;
ASSERT(pThis != NULL);
-
- strmDestruct(&pThis->tVars.disk.pWrite);
- strmDestruct(&pThis->tVars.disk.pRead);
+
+ if (pThis->tVars.disk.pWrite != NULL)
+ strmDestruct(&pThis->tVars.disk.pWrite);
+ if (pThis->tVars.disk.pRead != NULL)
+ strmDestruct(&pThis->tVars.disk.pRead);
RETiRet;
}
@@ -1209,7 +1211,7 @@ static rsRetVal qqueueShutdownWorkers(qqueue_t *pThis)
/* we need to re-aquire the mutex for the next check in this case! */
BEGIN_MTX_PROTECTED_OPERATIONS(pThis->mut, LOCK_MUTEX); /* some workers may be running in parallel! */
}
- if(pThis->bIsDA && wtpGetCurNumWrkr(pThis->pWtpDA, LOCK_MUTEX) > 0) {
+ if(pThis->bRunsDA && wtpGetCurNumWrkr(pThis->pWtpDA, LOCK_MUTEX) > 0) {
/* and now the same for the DA queue */
END_MTX_PROTECTED_OPERATIONS(pThis->mut);
dbgoprint((obj_t*) pThis, "trying immediate shutdown of DA workers\n");
@@ -1662,7 +1664,7 @@ qqueueChkStopWrkrDA(qqueue_t *pThis)
if(pThis->bEnqOnly) {
bStopWrkr = 1;
} else {
- if(pThis->bRunsDA) {
+ if(pThis->bRunsDA == 2) {
ASSERT(pThis->pqDA != NULL);
if( pThis->pqDA->bEnqOnly
&& pThis->pqDA->sizeOnDiskMax > 0
@@ -1917,7 +1919,8 @@ static rsRetVal qqueuePersist(qqueue_t *pThis, int bIsCheckpoint)
pThis->bNeedDelQIF = 0;
}
/* indicate spool file needs to be deleted */
- CHKiRet(strmSetbDeleteOnClose(pThis->tVars.disk.pRead, 1));
+ if (pThis->tVars.disk.pRead != NULL)
+ CHKiRet(strmSetbDeleteOnClose(pThis->tVars.disk.pRead, 1));
FINALIZE; /* nothing left to do, so be happy */
}
@@ -1951,13 +1954,15 @@ static rsRetVal qqueuePersist(qqueue_t *pThis, int bIsCheckpoint)
}
/* now persist the stream info */
- CHKiRet(strmSerialize(pThis->tVars.disk.pWrite, psQIF));
- CHKiRet(strmSerialize(pThis->tVars.disk.pRead, psQIF));
+ if (pThis->tVars.disk.pWrite != NULL)
+ CHKiRet(strmSerialize(pThis->tVars.disk.pWrite, psQIF));
+ if (pThis->tVars.disk.pRead != NULL)
+ CHKiRet(strmSerialize(pThis->tVars.disk.pRead, psQIF));
/* tell the input file object that it must not delete the file on close if the queue
* is non-empty - but only if we are not during a simple checkpoint
*/
- if(bIsCheckpoint != QUEUE_CHECKPOINT) {
+ if(bIsCheckpoint != QUEUE_CHECKPOINT && pThis->tVars.disk.pRead != NULL) {
CHKiRet(strmSetbDeleteOnClose(pThis->tVars.disk.pRead, 0));
}
--
cgit