diff options
-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 |