Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
12.3.2, 12.3.3
-
None
-
Windows x64, MariaDB 12.3.2 / 12.3.3, binary logging enabled, MySqlConnector pooling (Connection Reset=true)
-
Can result in hang or crash
Description
Description
===========
On MariaDB 12.3.x for Windows, the server process crashes with exception 0xc0000005
when a pooled client connection is reset.
The crash is not in application SQL. It happens while handling COM_CHANGE_USER
(empty Query (0x0)), which connection-pool libraries send when taking a
connection from the pool with Connection Reset=true
(e.g. MySqlConnector default).
Call chain:
COM_CHANGE_USER
→ THD::change_user()
→ binlog_truncate_tmp_files()
→ truncate_io_cache()
→ my_win_lseek() ← crash (0xc0000005)
This was reproduced on 12.3.2 and still reproduces after upgrading to 12.3.3
(2026-08-22). The 12.3.3 changelog does not mention this stack.
With Connection Reset=false (no COM_CHANGE_USER on pool checkout), the server
does not crash.
This looks Windows-specific (my_win_lseek / my_winfile.cc). Linux pooling with
the same client setting has not shown this crash.
Related but different: MDEV-37282 (Linux assertion on CHANGE_USER with
encrypted tmp files). This report is a Windows access violation in
my_win_lseek(), not that assertion.
How to reproduce
================
1. Install MariaDB 12.3.2 or 12.3.3 on Windows x64.
2. Enable binary logging (the crashing path is binlog_truncate_tmp_files()).
3. From a client that uses pooling + connection reset, for example MySqlConnector:
Pooling=true;Connection Reset=true;
4. Open a connection, run a normal query, return it to the pool.
5. Open another connection from the same pool (this sends COM_CHANGE_USER).
6. Repeat under normal application load if needed. The crash often appears
on pool reuse rather than on the first connect.
Expected
========
COM_CHANGE_USER / THD::change_user() resets session state and returns OK.
The server stays running.
Actual
======
mariadbd/mysqld terminates. Windows service shows Stopped.
Clients then fail with errors such as
"Unable to connect to any of the specified MySQL hosts".
Workaround
==========
Set Connection Reset=false on the client/pool so COM_CHANGE_USER is not
sent on checkout. Pooling can stay enabled.
This is only a workaround. Connection Reset=true is the correct pooling
behavior (reset session state, detect dead connections). We cannot use it
on Windows 12.3.x until this crash is fixed.
Backtrace (from .err, please include in the bug report)
=======================================================
Attempting backtrace. Include this in the bug report.
(note: Retrieving this information may fail)
Thread pointer: 0x20324792ac0
server.dll!my_win_lseek()[my_winfile.cc:450]
server.dll!my_seek()[my_seek.c:64]
server.dll!inline_mysql_file_seek()[mysql_file.h:1263]
server.dll!truncate_io_cache()[mf_iocache.c:126]
server.dll!binlog_truncate_tmp_files()[log.cc:8084]
server.dll!THD::change_user()[sql_class.cc:1632]
server.dll!dispatch_command()[sql_parse.cc:1741]
server.dll!do_command()[sql_parse.cc:1437]
server.dll!tp_callback()[threadpool_common.cc:252]
KERNEL32.DLL!TermsrvOpenRegEntry()
ntdll.dll!TpSetWait()
ntdll.dll!RtlReleaseSRWLockExclusive()
KERNEL32.DLL!BaseThreadInitThunk()
ntdll.dll!RtlUserThreadStart()
Connection ID (thread ID): 75
Status: NOT_KILLED
Query (0x0):
A minidump was also written (mysqld.dmp in the data directory).
Can attach .err / .dmp if useful.