Uploaded image for project: 'Percona Server for MySQL'
  1. Percona Server for MySQL
  2. PS-296

MySQL is crashing with duplicateweedout=off and materialization=on


    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 5.7.x, Not 5.5.x, Not 5.6.x
    • Fix Version/s: 5.7.21-21
    • Component/s: None


      Only PS 5.7 branch is affected. Tested against 5.7.20-19.

      When a materialized temporary table from semijoin optimization has a long key, over 1000 bytes, the server will crash.


      Steps to reproduce:


      create table a (id int unsigned not null auto_increment primary key); 


      2. REPEAT query

      insert into a select null from a

       until it reaches that point, which will make it 256K-1 records



      > CREATE TABLE `big1` (`id` varbinary(999) NOT NULL,PRIMARY KEY (`id`)) ENGINE=InnoDB; 
      > CREATE TABLE `big2` (`id` varbinary(999) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB; 
      > insert into big1 select * from a; 
      > insert into big2 select * from a; 
      > set session optimizer_switch='duplicateweedout=off,materialization=on';
      mysql> explain select * from big1 where id in (select id from big2 ignore index (primary)) limit 10; 
      | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | 
      | 1 | SIMPLE | <subquery2> | NULL | ALL | NULL | NULL | NULL | NULL | NULL | 100.00 | NULL | 
      | 1 | SIMPLE | big1 | NULL | eq_ref | PRIMARY | PRIMARY | 1001 | <subquery2>.id | 1 | 100.00 | Using index | 
      | 2 | MATERIALIZED | big2 | NULL | ALL | NULL | NULL | NULL | NULL | 262604 | 100.00 | NULL | 
      3 rows in set, 1 warning (0.00 sec)
      mysql> select * from big1 where id in (select id from big2 ignore index (primary)) limit 10; 
      ERROR 2013 (HY000): Lost connection to MySQL server during query
      11:00:10 UTC - mysqld got signal 11 ;
      This could be because you hit a bug. It is also possible that this binary
      or one of the libraries it was linked against is corrupt, improperly built,
      or misconfigured. This error can also be caused by malfunctioning hardware.
      Attempting to collect some information that could help diagnose the problem.
      As this is a crash and something is definitely wrong, the information
      collection process might fail.
      Please help us make Percona Server better by reporting any
      bugs at http://bugs.percona.com/
      It is possible that mysqld could use up to 
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68324 K bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.
      Thread pointer: 0x4222120
      Attempting backtrace. You can use the following information to find out
      where mysqld died. If you see no messages after this, something went
      terribly wrong...
      stack_bottom = 7f09f01a4d30 thread_stack 0x40000
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (4239450): select * from big1 where id in (select id from big2 ignore index (primary)) limit 10
      Connection ID (thread ID): 7
      Status: NOT_KILLED

        Smart Checklist


            Issue Links



                • Assignee:
                  zsolt.parragi Zsolt Parragi
                  iwo.panowicz Iwo Panowicz
                • Votes:
                  2 Vote for this issue
                  8 Start watching this issue


                  • Created:

                    Time Tracking

                    Original Estimate - Not Specified
                    Not Specified
                    Remaining Estimate - 0 minutes
                    Time Spent - 6 hours, 7 minutes
                    6h 7m