Bug #23590 Partitions and events: crash when events alter and drop partitions
Submitted: 24 Oct 2006 18:06 Modified: 24 Nov 2007 21:08
Reporter: Peter Gulutzan Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.13-beta-debug OS:Linux (SUSE 10.0 / 64-bit)
Assigned to: Assigned Account CPU Architecture:Any
Tags: bfsm_2007_10_18, Q1

[24 Oct 2006 18:06] Peter Gulutzan
Description:
I create a partitioned table.
I create two events: one event adds a partition, the other event drops it.
I create a procedure which inserts and selects from the table.
I enable the event scheduler and call the procedure.
Crash.

The crash might happen within one minute, or it might take many minutes.
But it's reliable, the crash always happens eventually.

How to repeat:
create database d45;
use d45;
create table tv (s1 int) engine=myisam partition by list (s1) (partition p0 values in (0));
create event e1 on schedule every 1 second do alter table d45.tv add partition (partition p1 values in (1));
create event e2 on schedule every 1 second do alter table d45.tv drop partition p1;
delimiter //
create procedure pv ()
begin
  declare v int default 0;
  declare continue handler for sqlexception select 'error';
  while v < 100000 do
    insert into tv values (0),(1);
    select * from tv;
    set v = v + 1;
    end while;
  end//
set global event_scheduler = 1//
call pv()//
[24 Oct 2006 21:56] MySQL Verification Team
Thank you for the bug report. Verified on Suse 10.0 32-bit:

1795 rows in set (3 min 6.60 sec)

ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>
[30 Nov 2006 22:38] Konstantin Osipov
This might be a duplicate of Bug#4968. Please wait until Bug#4968 is pushed to see.
[26 Sep 2007 23:43] Jeffrey Pugh
I ran the above test for 30 minutes on Win32 without a crash. Perhaps it has been fixed by the patch Kostja mentions. Can you reverify?
[27 Sep 2007 0:22] MySQL Verification Team
Still the crash happens re-verified on FC 7 64-bit:

[New Thread 1148234064 (LWP 14387)]
070926 21:17:54 [Note] Event Scheduler: [root@localhost].[d45.e1] started in thread 382.
070926 21:17:54 [Note] Event Scheduler: [root@localhost].[d45.e2] started in thread 381.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1147701584 (LWP 14000)]
0x00000000006e0adf in open_table_from_share (thd=0x1a2e4d8, share=0x1ab4b28, alias=0x1a77060 "tv", db_stat=39,
    prgflag=44, ha_open_flags=0, outparam=0x1ab5998, is_create_table=false) at table.cc:1784
1784        outparam->part_info->is_auto_partitioned= share->auto_partitioned;
(gdb) bt full
#0  0x00000000006e0adf in open_table_from_share (thd=0x1a2e4d8, share=0x1ab4b28, alias=0x1a77060 "tv",
    db_stat=39, prgflag=44, ha_open_flags=0, outparam=0x1ab5998, is_create_table=false) at table.cc:1784
        backup_arena = {_vptr.Query_arena = 0xb94170, free_list = 0x0, mem_root = 0x44686310,
  is_backup_arena = true, state = Query_arena::INITIALIZED_FOR_SP}
        tmp = true
        backup_stmt_arena_ptr = (class Query_arena *) 0x1a774f0
        part_func_arena = {_vptr.Query_arena = 0xb94170, free_list = 0x0, mem_root = 0x1ab6150,
  is_backup_arena = false, state = Query_arena::INITIALIZED}
        work_part_info_used = false
        error = 4
        records = 2
        i = 1
        bitmap_size = 28003112
        error_reported = false
        record = (uchar *) 0x1ac2ee7 ""
        bitmaps = (uchar *) 0x700002000 <Address 0x700002000 out of bounds>
        field_ptr = (class Field **) 0x1ac2f00
        _db_func_ = 0xbf19c5 "open_unireg_entry"
        _db_file_ = 0xbf0569 "sql_base.cc"
        _db_level_ = 14
        _db_framep_ = (char **) 0xb00bf198f
        __PRETTY_FUNCTION__ = "int open_table_from_share(THD*, TABLE_SHARE*, const char*, uint, uint, uint, TABLE*, bool)"
---Type <return> to continue, or q <return> to quit---

<cut>

|    0 |
+------+
5584 rows in set (3 min 10.50 sec)

ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>     

[miguel@luar mysql-5.1]$ bk changes | head
ChangeSet@1.2563, 2007-09-25 17:44:53+02:00, df@pippilotta.erinye.com +2 -0
  Merge pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.1
  into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.1-build
  MERGE: 1.2541.1.20

ChangeSet@1.2562, 2007-09-24 11:48:27+02:00, jperkin@production.mysql.com +1 -0
  Merge production.mysql.com:/usersnfs/jperkin/bk/build-5.0
  into  production.mysql.com:/usersnfs/jperkin/bk/build-5.1
  MERGE: 1.1810.3291.9

[miguel@luar mysql-5.1]$
[29 Oct 2007 12:28] Timour Katchaounov
P1 as it is a crash.
[24 Nov 2007 21:08] Alexey Botchkov
after Sergey Glukhov's fix to Bug #32178 seems to be fixed