Bug #33151 creating temporary table with BIT causes free(): invalid next size (fast) crash
Submitted: 11 Dec 2007 19:43 Modified: 11 Jan 2008 20:32
Reporter: greg orlowski Email Updates:
Status: No Feedback Impact on me:
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.27 vanilla OS:Linux (compiled from vanilla 5.0.27 source on centos 5.0)
Assigned to: CPU Architecture:Any

[11 Dec 2007 19:43] greg orlowski
When I execute a query to create a temporary table that has a BIT(1) field and some other fields, the mysql server process hangs with:

 *** glibc detected *** /usr/local/mysql-server-5.0.27/libexec/mysqld: free(): invalid next size (fast): 0x0aa2cbb0 ***
======= Backtrace: =========
======= Memory map: ========

After the error, my mysql client hangs. The mysql server process will not respond to a kill -TERM. uptime shows that there is no load on the system (0.00). I cannot log into mysql any more with my mysql client. I have to kill -9 the mysqld_safe and mysqld processes.

*** If I set my temporary table engine to InnoDB, the same error occurs. If I change the BIT(1) to a tinyint(1), the temp table is created successfully and there is no error.

*** My gcc:
gcc (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52)

How to repeat:
I tried to execute this query:
CREATE TEMPORARY TABLE STAGE.tmp_spell_discharge (
        resident_spell_id                       int(11) NOT NULL,
        livar_type_code                         varchar(3) NOT NULL,
        discharge_type_id                       tinyint(1) default NULL,
        disposition_type_id                     tinyint(1) default NULL,
        outcome_type_id                         tinyint(1) default NULL,
        discharge_completed_flg                 BIT(1) NOT NULL,
        INDEX                                   ( resident_spell_id ),
        INDEX                                   ( resident_spell_id, livar_type_code )
    rrs.resident_spell_id                               as resident_spell_id ,
    rrs.eff_livar_type_code                             as livar_type_code ,
    rlat.discharge_type_id                              as discharge_type_id ,
    rlat.disposition_type_id                            as disposition_type_id ,
    rlat.outcome_type_id                                as outcome_type_id ,
    IF ((
        rlat.discharge_type_id IS NOT NULL
        AND rlat.disposition_type_id IS NOT NULL
        AND rlat.outcome_type_id IS NOT NULL
        ), 1, 0)                                        as discharge_completed_flg
    rtos.rtos_resident_spell rrs
    LEFT OUTER JOIN rtos_resident_discharge rrd USING ( resident_spell_id )
    JOIN rtos_living_arrangement_type rlat ON ( rrs.eff_livar_type_code = rlat.livar_type_code )
    rrs.spell_status = 'D'
    AND rrd.resident_discharge_id IS NULL
ORDER BY resident_spell_id ASC

Here are the tables from which I am selecting:
 show create table rtos_living_arrangement_type;

| rtos_living_arrangement_type | CREATE TABLE `rtos_living_arrangement_type` (
  `livar_type_code` varchar(3) NOT NULL,
  `livar_type_descr` varchar(40) default NULL,
  `interruption_type` varchar(50) default NULL,
  `outcome_type_id` tinyint(1) default NULL,
  `disposition_type_id` tinyint(1) default NULL,
  `discharge_type_id` tinyint(1) default NULL,
  PRIMARY KEY  (`livar_type_code`)

| rtos_resident_spell | CREATE TABLE `rtos_resident_spell` (
  `resident_spell_id` int(11) NOT NULL auto_increment,
  `client_id` int(11) NOT NULL,
  `agency_corp_id` int(11) NOT NULL,
  `resident_discharge_id` int(11) default NULL,
  `spell_status` char(1) NOT NULL,
  `admission_date` datetime NOT NULL,
  `interruption_date` datetime default NULL,
  `action_date` datetime default NULL,
  `discharge_date` datetime default NULL,
  `status_flg` char(1) NOT NULL default 'A',
  `updated_by` int(11) NOT NULL,
  `updated_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `eff_placement_date` datetime NOT NULL,
  `eff_agency_id` int(11) NOT NULL,
  `outcomes_mgr_id` int(11) default NULL,
  `unit_id` int(11) default NULL,
  `eff_livar_type_code` varchar(3) NOT NULL,
  PRIMARY KEY  (`resident_spell_id`),
  KEY `idx_client_id` (`client_id`),
  KEY `fk_rrs_outcomes_mgr_id` (`outcomes_mgr_id`),
  KEY `fk_rrs_eff_agency_id` (`eff_agency_id`),
  CONSTRAINT `fk_rrs_client_id` FOREIGN KEY (`client_id`) REFERENCES `canscore`.`service_client` (`client_id`) ON UPDATE CASCADE,
  CONSTRAINT `fk_rrs_eff_agency_id` FOREIGN KEY (`eff_agency_id`) REFERENCES `canscore`.`cans_agency` (`agency_id`) ON UPDATE CASCADE,
  CONSTRAINT `fk_rrs_outcomes_mgr_id` FOREIGN KEY (`outcomes_mgr_id`) REFERENCES `canscore`.`cans_agency_personnel` (`person_id`) ON DELETE SET NULL ON UPDATE CASCADE

[11 Dec 2007 20:32] Valeriy Kravchuk
Thank you for a problem report. Please, try to repeat with a newer version, 5.0.51, and inform about the results.
[12 Jan 2008 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".