Details
Description
Discovered this while working on MDEV-34125. Its initial testcase fails like this:
==11329== Thread 10:
|
==11329== Conditional jump or move depends on uninitialised value(s)
|
==11329== at 0xFA06FE: ha_handler_stats::has_stats() (ha_handler_stats.h:58)
|
==11329== by 0xF86200: MYSQL_QUERY_LOG::write(THD*, long, char const*, unsigned long, unsigned long long, unsigned long long, bool, char const*, unsigned long) (log.cc:3273)
|
==11329== by 0xF7F944: Log_to_file_event_handler::log_slow(THD*, my_hrtime_t, char const*, unsigned long, unsigned long long, unsigned long long, bool, char const*, unsigned long) (log.cc:1076)
|
==11329== by 0xF80615: LOGGER::slow_log_print(THD*, char const*, unsigned long, unsigned long long) (log.cc:1350)
|
==11329== by 0xF91F6B: slow_log_print(THD*, char const*, unsigned int, unsigned long long) (log.cc:6950)
|
==11329== by 0xA84E94: log_slow_statement(THD*) (sql_parse.cc:2585)
|
==11329== by 0xA848B0: dispatch_command(enum_server_command, THD*, char*, unsigned int, bool) (sql_parse.cc:2453)
|
This happens for this statement:
set long_query_time=0.0, log_slow_verbosity='engine'; |
Attachments
Issue Links
- relates to
-
MDEV-34125 ANALYZE FORMAT=JSON: r_engine_stats.pages_read_time_ms has wrong scale
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Link |
This issue relates to |
Fix Version/s | 10.6 [ 24028 ] |
Assignee | Sergei Petrunia [ psergey ] | Rex Johnston [ JIRAUSER52533 ] |
Assignee | Rex Johnston [ JIRAUSER52533 ] | Michael Widenius [ monty ] |
issue.field.resolutiondate | 2024-10-03 13:59:16.0 | 2024-10-03 13:59:15.668 |
Fix Version/s | 10.6.20 [ 29903 ] | |
Fix Version/s | 10.6 [ 24028 ] | |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Fix Version/s | 10.11.10 [ 29904 ] | |
Fix Version/s | 11.2.6 [ 29906 ] | |
Fix Version/s | 11.4.4 [ 29907 ] |
The failure happens when accessing THD::handler_stats.
That variable is NOT initialized by default.
It is reset in THD::reset_slow_query_state():
handler_stats.reset();
Then, in MYSQL_QUERY_LOG::write(), it is checked:
LOG_SLOW_VERBOSITY_ENGINE) &&
thd->handler_stats.has_stats())
{
Now, consider this scenario of running a statement