Skip to content

Commit a84fae2

Browse files
committed
MDEV-8836 - Server crashed in my_copy_8bit on querying I_S.PROCESSLIST
Fixed race condition in code filling INFORMATION_SCHEMA.PROCESSLIST.INFO_BINARY. When loading query string/length of another connection one must have LOCK_thd_data locked.
1 parent e1cbca1 commit a84fae2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

sql/sql_show.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2888,6 +2888,15 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
28882888
table->field[7]->set_notnull();
28892889
}
28902890

2891+
/* INFO_BINARY */
2892+
if (tmp->query())
2893+
{
2894+
table->field[15]->store(tmp->query(),
2895+
MY_MIN(PROCESS_LIST_INFO_WIDTH,
2896+
tmp->query_length()), &my_charset_bin);
2897+
table->field[15]->set_notnull();
2898+
}
2899+
28912900
/*
28922901
Progress report. We need to do this under a lock to ensure that all
28932902
is from the same stage.
@@ -2916,15 +2925,6 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
29162925
/* QUERY_ID */
29172926
table->field[14]->store(tmp->query_id, TRUE);
29182927

2919-
/* INFO_BINARY */
2920-
if (tmp->query())
2921-
{
2922-
table->field[15]->store(tmp->query(),
2923-
MY_MIN(PROCESS_LIST_INFO_WIDTH,
2924-
tmp->query_length()), &my_charset_bin);
2925-
table->field[15]->set_notnull();
2926-
}
2927-
29282928
table->field[16]->store(tmp->os_thread_id);
29292929

29302930
if (schema_table_store_record(thd, table))

0 commit comments

Comments
 (0)