Bug #45496 Performance schema: assertion fails in ha_perfschema::rnd_init:223

Submitted: 15 Jun 2009 10:50 Modified: 14 Jan 2010 18:07
Reporter: Jørgen Austvik Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S2 (Serious)
Version:azalea-perfschema OS:Any
Assigned to: Marc ALFF CPU Architecture:Any

[15 Jun 2009 10:50] Jørgen Austvik
Description:
Hi, I manage to crash MySQL with the current SQL statement now. It worked before 2009-03-05, and fails after 2009-03-06.

SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
WHERE THREAD_ID IN
  (SELECT THREAD_ID FROM performance_schema.PROCESSLIST)
AND EVENT_NAME IN
  (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
   WHERE NAME LIKE "wait/synch/%")
LIMIT 1;

100% reproducible here.

Program terminated with signal 6, Aborted.
#0  0x0000003f1100b122 in pthread_kill () from /lib64/libpthread.so.0
#0  0x0000003f1100b122 in pthread_kill () from /lib64/libpthread.so.0
#1  0x000000000064fe5c in handle_segfault (sig=6) at mysqld.cc:2722
#2  <signal handler called>
#3  0x0000003f10430045 in raise () from /lib64/libc.so.6
#4  0x0000003f10431ae0 in abort () from /lib64/libc.so.6
#5  0x0000003f10429756 in __assert_fail () from /lib64/libc.so.6
#6  0x0000000000a444a6 in ha_perfschema::rnd_init (this=0xfe8f138, scan=<value optimized out>) at ha_perfschema.cc:223
#7  0x00000000007718ae in init_read_record (info=0xff20e78, thd=0xfce3880, table=0xfe8e880, select=0xff21940, use_record_cache=1, print_error=<value optimized out>,
    disable_rr_cache=false) at handler.h:1578
#8  0x00000000006c5fa9 in join_init_read_record (tab=0xff20df0) at sql_select.cc:17085
#9  0x00000000006e8e7a in sub_select (join=0xff0cd78, join_tab=0xff20df0, end_of_records=6) at sql_select.cc:16280
#10 0x00000000006e8bbc in evaluate_join_record (join=0xff0cd78, join_tab=0xff20b50, error=<value optimized out>) at sql_select.cc:16548
#11 0x00000000006e8d6b in sub_select (join=0xff0cd78, join_tab=0xff20b50, end_of_records=<value optimized out>) at sql_select.cc:16315
#12 0x00000000006e71be in do_select (join=0xff0cd78, fields=0xfce5758, table=0x0, procedure=0x0) at sql_select.cc:15844
#13 0x00000000006ed45a in JOIN::exec (this=0xff0cd78) at sql_select.cc:2886
#14 0x00000000006eef0e in mysql_select (thd=0xfce3880, rref_pointer_array=0xfce5838, tables=0xfd40b10, wild_num=0, fields=@0xfce5758, conds=0xff0bec0, og_num=0,
    order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147764736, result=0xff0c078, unit=0xfce51e8, select_lex=0xfce5650) at sql_select.cc:3067
#15 0x00000000006ef9d4 in handle_select (thd=0xfce3880, lex=0xfce5148, result=0xff0c078, setup_tables_done_option=0) at sql_select.cc:310
#16 0x0000000000661c7e in execute_sqlcom_select (thd=0xfce3880, all_tables=0xfd40b10) at sql_parse.cc:4980
#17 0x0000000000667467 in mysql_execute_command (thd=0xfce3880) at sql_parse.cc:2188
#18 0x000000000066b5cf in mysql_parse (thd=0xfce3880,
    inBuf=0xfd40508 "SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT\nWHERE THREAD_ID IN\n(SELECT THREAD_ID FROM performance_schema.PROCESSLIST)\nAND EVENT_NAME IN\n(SELECT NAME FROM performance_schema.SETUP_INST"..., length=247, found_semicolon=0x4932bfe0) at sql_parse.cc:5995
#19 0x000000000066c22f in dispatch_command (command=COM_QUERY, thd=0xfce3880, packet=0xfd1b831 "", packet_length=<value optimized out>) at sql_parse.cc:1080
#20 0x000000000066ce53 in do_command (thd=0xfce3880) at sql_parse.cc:762
#21 0x000000000065db14 in do_handle_one_connection (thd_arg=0xfce3880) at sql_connect.cc:1156
#22 0x000000000065dbfa in handle_one_connection (arg=<value optimized out>) at sql_connect.cc:1108
#23 0x0000000000a50ef6 in pfs_spawn_thread (arg=<value optimized out>) at pfs.cc:1005
#24 0x0000003f110062e7 in start_thread () from /lib64/libpthread.so.0
#25 0x0000003f104ce3bd in clone () from /lib64/libc.so.6

   216  int ha_perfschema::rnd_init(bool scan)
   217  {
   218    int result;
   219    DBUG_ENTER("ha_perfschema::rnd_init");
   220
   221    DBUG_ASSERT(m_table_share);
   222    DBUG_ASSERT(m_table_share->m_open_table != NULL);
   223    DBUG_ASSERT(m_table == NULL);
   224
   225    stats.records= 0;
   226    m_table= m_table_share->m_open_table();
   227    if (m_table)

How to repeat:
Run the select query on mysql-6.0-perfschema branch
[2 Jul 2009 0:25] MySQL Verification Team
To repeat this issue just run the query in fresh database?. Thanks in advance.

c:\mysql>bin\mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 6.0.12-alpha-Win X64-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
    -> WHERE THREAD_ID IN
    ->   (SELECT THREAD_ID FROM performance_schema.PROCESSLIST)
    -> AND EVENT_NAME IN
    ->   (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
    ->    WHERE NAME LIKE "wait/synch/%")
    -> LIMIT 1;
Empty set (0.08 sec)

mysql>
[2 Jul 2009 7:58] Jørgen Austvik
You would have to do something like this first to get some data for the query:

UPDATE performance_schema.SETUP_INSTRUMENTS SET enabled = 'YES', timed = 'YES';

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value')
ENGINE=MyISAM;
INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8);

But you are right: it seems to work now:

mysql> SELECT EVENT_ID FROM performance_schema.EVENTS_WAITS_CURRENT
    -> WHERE THREAD_ID IN
    ->   (SELECT THREAD_ID FROM performance_schema.PROCESSLIST)
    -> AND EVENT_NAME IN
    ->   (SELECT NAME FROM performance_schema.SETUP_INSTRUMENTS
    ->    WHERE NAME LIKE "wait/synch/%")
    -> LIMIT 1;
+----------+
| EVENT_ID |
+----------+
|      984 | 
+----------+
1 row in set (0.00 sec)

This report can probably be closed now?
[2 Jul 2009 23:48] MySQL Verification Team
Thank you for the feedback. Closing as can`t repeat.
[4 Aug 2009 8:33] Philip Stoev
This is still repeatable, but with even simpler queries such as:

SELECT *
FROM `information_schema` .`COLUMNS`
JOIN `performance_schema` .`PROCESSLIST`;

assertion:

mysqld: ha_perfschema.cc:248: virtual int ha_perfschema::rnd_init(bool): Assertion `m_table == __null' failed.

backtrace:

ha_perfschema::rnd_init(bool)+0xa7) [0xa02dc9]
handler::ha_rnd_init(bool)+0x83) [0x589d4b]
init_read_record(READ_RECORD*, THD*, TABLE*, SQL_SELECT*, int, bool, bool)+0x581) [0x7d1d04]
join_init_read_record(st_join_table*)+0xae) [0x705c57]
JOIN_CACHE_BNL::join_matching_records(bool)+0x172) [0x6d5d68]
JOIN_CACHE::join_records(bool)+0x83) [0x6d42f3]
sub_select_cache(JOIN*, st_join_table*, bool)+0x6a) [0x7096d7]
sub_select(JOIN*, st_join_table*, bool)+0x47) [0x709362]
/build/bzr/azalea-perfschema/sql/mysqld [0x716f94]
JOIN::exec()+0x2421) [0x7312eb]
mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*)+0x318) [0x72bd72]
handle_select(THD*, LEX*, select_result*, unsigned long)+0x1de) [0x73160a]
/build/bzr/azalea-perfschema/sql/mysqld [0x689e54]
mysql_execute_command(THD*)+0x9d6) [0x68b96d]
mysql_parse(THD*, char const*, unsigned int, char const**)+0x276) [0x694407]
dispatch_command(enum_server_command, THD*, char*, unsigned int)+0xa84) [0x695022]
do_command(THD*)+0x22b) [0x69653d]
do_handle_one_connection(THD*)+0x12c) [0x682b87]
handle_one_connection+0x2d) [0x682c56]
[4 Aug 2009 8:34] Philip Stoev
1. Start server

$ MTR_VERSION=1 perl mysql-test-run.pl --start-and-exit 1st;

2. Clone test-extra-6.0 and populate database

$ cd mysql-test/gentest
$ perl gendata-old.pl

3. Run query:

SELECT *
FROM `information_schema` .`COLUMNS`
JOIN `performance_schema` .`PROCESSLIST`;
[4 Aug 2009 18:17] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/80077

2848 Marc Alff	2009-08-04
      Bug#45496 Performance schema: assertion fails in ha_perfschema::rnd_init:223
      
      Implemented review comments for rnd_init(),
      which also resolves bug 45496
      added:
        mysql-test/suite/perfschema/r/misc.result
        mysql-test/suite/perfschema/t/misc.test
      modified:
        storage/perfschema/ha_perfschema.cc
[4 Nov 2009 18:21] Marc ALFF
Already pushed in mysql-trunk-perfschema
[14 Jan 2010 10:04] Marc ALFF
Merged in:
- mysql-next-mr (Celosia / 5.5.99-m3)
- mysql-6.0-codebase (6.0.14)
[14 Jan 2010 18:07] Paul DuBois
Not in any released version. No changelog entry needed.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.065 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.