mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-13 04:50:41 +01:00
There was a race between tcpflood and rsyslog in imptpc_maxsessions.sh. We now use the new -A tcpflood option to make the timing more predictable, hopefully fixing test flakiness. Note: if that does not help, we need to introduce a wait on the number of error messages and maybe a delay before tcpflood termination. The theory behind the latter is that rsyslog possibly does not fully iniaitlize session which are quickly aborted before rsyslog receives the related OS notification! We just record this info in case we need it and are positive that this change will fix the situation.
48 lines
1.3 KiB
Bash
Executable File
48 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# Test imtcp with many dropping connections
|
|
# added 2010-08-10 by Rgerhards
|
|
#
|
|
# This file is part of the rsyslog project, released under GPLv3
|
|
. ${srcdir:=.}/diag.sh init
|
|
skip_platform "FreeBSD" "This test currently does not work on FreeBSD"
|
|
export NUMMESSAGES=500
|
|
|
|
MAXSESSIONS=10
|
|
CONNECTIONS=20
|
|
EXPECTED_DROPS=$((CONNECTIONS - MAXSESSIONS))
|
|
|
|
EXPECTED_STR='too many tcp sessions - dropping incoming request'
|
|
wait_too_many_sessions()
|
|
{
|
|
test "$(grep "$EXPECTED_STR" "$RSYSLOG_OUT_LOG" | wc -l)" = "$EXPECTED_DROPS"
|
|
}
|
|
|
|
export QUEUE_EMPTY_CHECK_FUNC=wait_too_many_sessions
|
|
generate_conf
|
|
add_conf '
|
|
$MaxMessageSize 10k
|
|
|
|
module(load="../plugins/imptcp/.libs/imptcp" maxsessions="'$MAXSESSIONS'")
|
|
input(type="imptcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port")
|
|
action(type="omfile" file=`echo $RSYSLOG_OUT_LOG`)
|
|
|
|
$template outfmt,"%msg:F,58:2%,%msg:F,58:3%,%msg:F,58:4%\n"
|
|
$OMFileFlushInterval 2
|
|
$OMFileIOBufferSize 256k
|
|
'
|
|
startup
|
|
|
|
echo "INFO: RSYSLOG_OUT_LOG: $RSYSLOG_OUT_LOG"
|
|
|
|
echo "About to run tcpflood"
|
|
tcpflood -c$CONNECTIONS -m$NUMMESSAGES -r -d100 -P129 -A
|
|
echo "-------> NOTE: CLOSED REMOTELY messages are expected and OK! <-------"
|
|
echo "done run tcpflood"
|
|
shutdown_when_empty
|
|
wait_shutdown
|
|
|
|
content_count_check "$EXPECTED_STR" $EXPECTED_DROPS
|
|
echo "Got expected drops: $EXPECTED_DROPS, looks good!"
|
|
|
|
exit_test
|