diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-03-17 16:39:18 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-03-17 16:39:18 +0100 |
commit | 679434312c20d9651faff26b8b3a5ab203be7ff3 (patch) | |
tree | 105bf490b92b0033e3f8c2a5e070136d40337741 /tests | |
parent | ba0f23182a55b26b2265d2138c707cbc7ddbb72e (diff) | |
download | rsyslog-679434312c20d9651faff26b8b3a5ab203be7ff3.tar.gz rsyslog-679434312c20d9651faff26b8b3a5ab203be7ff3.tar.xz rsyslog-679434312c20d9651faff26b8b3a5ab203be7ff3.zip |
added test to check for deadlock condition in async-written files
Note that this introduces a test case that breaks the current code. This
commit does NOT yet provide the necessary code patch. Thus make check
does currently hang.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 3 | ||||
-rwxr-xr-x | tests/asynwr_deadlock.sh | 23 | ||||
-rw-r--r-- | tests/testsuites/asynwr_deadlock.conf | 21 |
3 files changed, 47 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index bc7902b1..3c2223d9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -14,6 +14,7 @@ TESTS = $(TESTRUNS) cfg.sh \ asynwr_small.sh \ asynwr_tinybuf.sh \ asynwr_large.sh \ + asynwr_deadlock.sh \ gzipwr_large.sh \ gzipwr_large_dynfile.sh \ complex1.sh \ @@ -154,6 +155,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/asynwr_tinybuf.conf \ asynwr_large.sh \ testsuites/asynwr_large.conf \ + asynwr_deadlock.sh \ + testsuites/asynwr_deadlock.conf \ gzipwr_large.sh \ testsuites/gzipwr_large.conf \ gzipwr_large_dynfile.sh \ diff --git a/tests/asynwr_deadlock.sh b/tests/asynwr_deadlock.sh new file mode 100755 index 00000000..2d08419c --- /dev/null +++ b/tests/asynwr_deadlock.sh @@ -0,0 +1,23 @@ +# This is test case from practice, with the version we introduced it, it +# caused a deadlock on shutdown. I have added it to the test suite to automatically +# detect such things in the future. +# +# added 2010-03-17 by Rgerhards +# This file is part of the rsyslog project, released under GPLv3 +echo ================================================================================ +echo TEST: \[asynwr_deadlock.sh\]: a case known to have caused a deadlock in the past +source $srcdir/diag.sh init +# uncomment for debugging support: +export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" +export RSYSLOG_DEBUGLOG="log" +source $srcdir/diag.sh startup asynwr_deadlock.conf +# just send one message +source $srcdir/diag.sh tcpflood -m1 +# sleep is important! need to make sure the instance is inactive +sleep 1 +# now try shutdown. The actual test is if the process does hang here! +echo "processing must continue soon" +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown # and wait for it to terminate +source $srcdir/diag.sh seq-check 0 0 +source $srcdir/diag.sh exit diff --git a/tests/testsuites/asynwr_deadlock.conf b/tests/testsuites/asynwr_deadlock.conf new file mode 100644 index 00000000..b3a052df --- /dev/null +++ b/tests/testsuites/asynwr_deadlock.conf @@ -0,0 +1,21 @@ +# simple async writing test +# rgerhards, 2010-03-09 +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/imtcp/.libs/imtcp +$MainMsgQueueTimeoutShutdown 10000 +$InputTCPServerRun 13514 + +$template outfmt,"%msg:F,58:2%\n" +$template dynfile,"rsyslog.out.log" # trick to use relative path names! + +$OMFileFlushOnTXEnd on +$OMFileFlushInterval 10 +$OMFileFlushIOBufferSize 10k +#:msg, contains, "msgnum:" ?dynfile;outfmt +:msg, contains, "msgnum:" ./rsyslog.out.log;outfmt + +$OMFileFlushOnTXEnd on +$OMFileFlushInterval 10 +$OMFileFlushIOBufferSize 10k +#:msg, contains, "msgnum:" ./rsyslog.out.2.log;outfmt |