Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
11.8, 12.3, 13.1, 12.3.3
-
None
-
Linux x86_64; Docker; official image
`mariadb@sha256:dd9b303aed4f4890ed09f766d8ca9ddfd176c0c6f6267feff53b3192ec65a979`;
server reports `12.3.3-MariaDB-ubu2404`, source revision
`83e909fc2a0dbc394b4b683fb3fa2d7dcf26cc5e`.
Description
After a tracked plugin variable is removed, the global
`session_track_system_variables` value remains stale. A session that executes
`SET SESSION session_track_system_variables=DEFAULT` then receives ER 1193,
but the failed statement nevertheless replaces its previous tracker list with
an empty string. This violates the usual expectation that a failed `SET` does
not publish the rejected value.
Steps to reproduce
set -eu
|
IMAGE='mariadb@sha256:dd9b303aed4f4890ed09f766d8ca9ddfd176c0c6f6267feff53b3192ec65a979'
|
C="mdev-mcf205-$$"
|
OWNER="mdev-mcf205-$$"
|
cleanup() {
|
if docker inspect --format '{{ index .Config.Labels "io.encryptiondbfuzz.owner" }}' \
|
"$C" 2>/dev/null | grep -Fqx "$OWNER"; then
|
docker rm -f "$C" >/dev/null 2>&1 || true
|
fi
|
}
|
trap cleanup EXIT
|
|
|
docker run --detach --name "$C" \
|
--label "io.encryptiondbfuzz.owner=$OWNER" \
|
--network none --read-only --cap-drop ALL \
|
--security-opt no-new-privileges=true --pids-limit 160 \
|
--memory 1g --cpus 1 --user 999:999 \
|
--tmpfs /var/lib/mysql:rw,nosuid,nodev,size=512m,uid=999,gid=999 \
|
--tmpfs /run/mysqld:rw,nosuid,nodev,size=16m,uid=999,gid=999 \
|
--tmpfs /tmp:rw,nosuid,nodev,size=64m,uid=999,gid=999 \
|
--env MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 "$IMAGE" >/dev/null
|
|
|
READY=0
|
for I in $(seq 1 90); do
|
if docker exec --user 999:999 "$C" mariadb --protocol=socket \
|
--socket=/run/mysqld/mysqld.sock -uroot -NBe 'SELECT VERSION()' \
|
2>/dev/null; then
|
READY=1
|
break
|
fi
|
sleep 1
|
done
|
test "$READY" -eq 1
|
|
|
SQL="docker exec --user 999:999 $C mariadb --protocol=socket --socket=/run/mysqld/mysqld.sock -uroot --batch --skip-column-names"
|
$SQL -e "INSTALL SONAME 'query_response_time';
|
SET GLOBAL session_track_system_variables='query_response_time_session_stats';
|
SET SESSION session_track_system_variables=DEFAULT;
|
SELECT CONCAT('control=<',@@session.session_track_system_variables,'>');
|
UNINSTALL SONAME 'query_response_time';
|
SELECT CONCAT('stale_global=<',@@global.session_track_system_variables,'>');"
|
|
|
# --force keeps this one session alive after ER 1193, allowing the post-error
|
# session value to be read from the same THD.
|
printf '%s\n' \
|
'SET SESSION session_track_system_variables=DEFAULT;' \
|
"SELECT CONCAT('after_error=<',@@session.session_track_system_variables,'>');" \
|
| $SQL --force
|
|
|
$SQL -e 'SELECT CONCAT("server_health=",1)'
|
Actual result
The control session inherits the installed plugin variable. After unload, the
global value is still stale. The trigger prints an error and then shows that
the failed statement has committed an empty session value:
control=<query_response_time_session_stats>
|
stale_global=<query_response_time_session_stats>
|
ERROR 1193 (HY000) at line 1: Unknown system variable 'query_response_time_session_stats'
|
after_error=<>
|
server_health=1
|
The server remains running; no crash was observed.
Expected result
Uninstalling the plugin should remove or safely resolve the stale tracked
variable. If `SET SESSION ...=DEFAULT` rejects the inherited value, the
statement must leave the prior session value unchanged. It must not both report
failure and publish a partially processed empty value.