mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-15 19:50:40 +01:00
The call rscript statement is able to call a rule set either synchronously or asynchronously. We did this, because practice showed that both modes are needed. For various reasons we decided to make async calls if the ruleset has a queue assigned and sync if not. To know if a "queue is assigned" we just checked if queue parameters were given. It was overlookeded the case of someone explicitly specifying a "direct queue", aka "no queue". As such, queue="direct" triggered async calls. That in turn meant that when a write operation to a variable was made inside that rule set, other rulesets could or could not see the write. While if was often not seen, this was a data race where the change could also be seen by the outside. This is now fixed. No matter if queue.type="direct" is specified or left out, the call will always by synchronous. Any values written to variables will also be seen by the "outside world" in later processing stages. Note that this has some potential to BREAK EXISTING CONFIGURATIONS. We deem this acceptable because: 1. this was racy at all, so unexpected behaviour could alwas occur 2. it is actually unlikely that someone used the triggering conditions in practice. But we can not outrule this, especially when the configuration was auto-generated. Potential compatibility issues can be solved by defining a small array-memory queue on the ruleset in question instead of specifying direct type. Again, we expect that almost all users will never experience any problems. If you do, however, please let us know: we may add an option to re-enable the bug.
28 lines
648 B
Bash
Executable File
28 lines
648 B
Bash
Executable File
#!/bin/bash
|
|
# check that ruleset is called synchronously when queue.type="direct" is
|
|
# specified in ruleset.
|
|
# added 2021-09-17 by rgerhards. Released under ASL 2.0
|
|
. ${srcdir:=.}/diag.sh init
|
|
generate_conf
|
|
export STATSFILE="$RSYSLOG_DYNNAME.stats"
|
|
add_conf '
|
|
template(name="outfmt" type="string" string="%msg%,%$.msg%\n")
|
|
|
|
ruleset(name="rs1" queue.type="direct") {
|
|
set $.msg = "TEST";
|
|
}
|
|
|
|
|
|
if $msg contains "msgnum:" then {
|
|
set $.msg = $msg;
|
|
call rs1
|
|
action(type="omfile" name="main-action" file="'$RSYSLOG_OUT_LOG'" template="outfmt")
|
|
}
|
|
'
|
|
startup
|
|
injectmsg 0 1
|
|
shutdown_when_empty
|
|
wait_shutdown
|
|
content_check "msgnum:00000000:,TEST"
|
|
exit_test
|