Bug #46094 Assertion failed: inited==RND if filesort interrupted
Submitted: 9 Jul 18:19
Reporter: Shane Bester
Status: Analyzing
Category:Server: Optimizer Severity:S2 (Serious)
Version:5.1.37-debug OS:Any
Assigned to: Shane Bester Target Version:
Tags: ha_rnd_end, assertion, KILL

[9 Jul 18:19] Shane Bester
Description:
killing explain at the right time can cause this assertion.

Assertion failed: inited==RND, file e:\builds\bzr\5.1\sql\handler.h, line 1191
090709 17:34:45 - mysqld got exception 0x80000003 ;

mysqld.exe!_NMSG_WRITE()[crt0msg.c:198]
mysqld.exe!abort()[abort.c:59]
mysqld.exe!_wassert()[assert.c:212]
mysqld.exe!handler::ha_rnd_end()[handler.h:1191]
mysqld.exe!find_all_keys()[filesort.cc:631]
mysqld.exe!filesort()[filesort.cc:245]
mysqld.exe!create_sort_index()[sql_select.cc:13489]
mysqld.exe!JOIN::exec()[sql_select.cc:2148]
mysqld.exe!mysql_select()[sql_select.cc:2388]
mysqld.exe!mysql_derived_filling()[sql_derived.cc:294]
mysqld.exe!mysql_handle_derived()[sql_derived.cc:56]
mysqld.exe!open_and_lock_tables_derived()[sql_base.cc:4995]
mysqld.exe!open_and_lock_tables()[mysql_priv.h:1555]
mysqld.exe!execute_sqlcom_select()[sql_parse.cc:4978]
mysqld.exe!mysql_execute_command()[sql_parse.cc:2208]
mysqld.exe!mysql_parse()[sql_parse.cc:5933]
mysqld.exe!dispatch_command()[sql_parse.cc:1213]
mysqld.exe!do_command()[sql_parse.cc:854]
mysqld.exe!handle_one_connection()[sql_connect.cc:1127]
mysqld.exe!pthread_start()[my_winthread.c:85]
mysqld.exe!_callthreadstart()[thread.c:293]
mysqld.exe!_threadstart()[thread.c:277]
kernel32.dll!FlsSetValue()

the table being queried here was a federated table, and the remote table was locked,
hence leaving the query in "sorting result" status.  Killing the locked query on remote
server thus interrupted the 'filesort' process.

How to repeat:
will make a testcase someday.