summaryrefslogtreecommitdiffstats
path: root/tests/asynwr_deadlock.sh
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-03-17 16:39:18 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2010-03-17 16:39:18 +0100
commit679434312c20d9651faff26b8b3a5ab203be7ff3 (patch)
tree105bf490b92b0033e3f8c2a5e070136d40337741 /tests/asynwr_deadlock.sh
parentba0f23182a55b26b2265d2138c707cbc7ddbb72e (diff)
downloadrsyslog-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/asynwr_deadlock.sh')
-rwxr-xr-xtests/asynwr_deadlock.sh23
1 files changed, 23 insertions, 0 deletions
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