LP #1675687: pt-online-schema-change crashes with perl malloc error
Description
Environment
Smart Checklist
Activity

lpjirasync January 24, 2018 at 9:33 PM
**Comment from Launchpad by: Carlos Salguero on: 07-04-2017 16:20:32
MacOS is not a supported platform.
It seems to be a problem within your DBI::MySQL driver.
According to the attached debug, the error is here:
DBI:mysql:database;;mysql_read_default_group=client =user undef ShowErrorStatement=>1, mysql_enable_utf8=>0, PrintError=>0, AutoCommit=>1, RaiseError=>1
perl(83945,0x7fffad7943c0) malloc: *** error for object 0x7f9f1ac35110: pointer being freed was not allocated
set a breakpoint in malloc_error_break to debug
Please try upgrading your DBI::MySQL driver from CPAN.

lpjirasync January 24, 2018 at 9:33 PM
**Comment from Launchpad by: Sveta Smirnova on: 06-04-2017 23:23:04
Thank you for the report.
I cannot repeat described behavior with pt-online-schema-change versions 2.2.20 and 3.0.2, connected to MariaDB 10.2.5:
$ ~/build/percona-toolkit/bin/pt-online-schema-change --execute --alter "ADD COLUMN c1 INT" -u root h=127.0.0.1,P=16020,D=test,t=attachments
No slaves found. See --recursion-method if host Thinkie has slaves.
Not checking slave lag because no slaves were found and --check-slave-lag was not specified.
Operation, tries, wait:
analyze_table, 10, 1
copy_rows, 10, 0.25
create_triggers, 10, 1
drop_triggers, 10, 1
swap_tables, 10, 1
update_foreign_keys, 10, 1
Altering `test`.`attachments`...
Creating new table...
Created new table test._attachments_new OK.
Altering new table...
Altered `test`.`_attachments_new` OK.
2017-04-07T02:20:54 Creating triggers...
2017-04-07T02:20:54 Created triggers OK.
2017-04-07T02:20:54 Copying approximately 1 rows...
2017-04-07T02:20:54 Copied rows OK.
2017-04-07T02:20:54 Swapping tables...
2017-04-07T02:20:54 Swapped original and new tables OK.
2017-04-07T02:20:54 Dropping old table...
2017-04-07T02:20:54 Dropped old table `test`.`_attachments_old` OK.
2017-04-07T02:20:54 Dropping triggers...
2017-04-07T02:20:54 Dropped triggers OK.
Successfully altered `test`.`attachments`.
With PTDEBUG=1 also no crash happens.
Please specify which version of pt-online-schema-change you use.

lpjirasync January 24, 2018 at 9:33 PM
**Comment from Launchpad by: alex on: 26-03-2017 14:56:03
Hello,
here is the DDL of the table:
CREATE TABLE `attachments` (
`id` int(11) NOT NULL,
`attachable_id` int(11) DEFAULT NULL,
`attachable_type` varchar(191) DEFAULT NULL,
`attachment` varchar(191) DEFAULT NULL,
`created_at` datetime NOT NULL,
`creator_id` int(11) DEFAULT NULL,
`filesize` int(11) DEFAULT 0,
`md5_digest` varchar(191) DEFAULT NULL,
`mime_type` varchar(191) DEFAULT NULL,
`network_id` int(11) DEFAULT NULL,
`origin` int(11) NOT NULL DEFAULT 0,
`type` varchar(30) DEFAULT NULL,
`updated_at` datetime NOT NULL,
`uuid` varchar(191) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_attachable_type_attachable_id` (`attachable_type`,`attachable_id`) USING BTREE,
KEY `index_attachments_on_creator_id` (`creator_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
regards

lpjirasync January 24, 2018 at 9:33 PM
**Comment from Launchpad by: Carlos Salguero on: 24-03-2017 18:34:01
Could you include the data structure?
Details
Details
Assignee
Reporter

Priority
Smart Checklist
Open Smart Checklist
Smart Checklist

**Reported in Launchpad by alex last update 07-04-2017 16:20:46
When I try to run pt-online-schema-change, it crashes with following message:
perl(83945,0x7fffad7943c0) malloc: *** error for object 0x7f9f1ac35110: pointer being freed was not allocated
set a breakpoint in malloc_error_break to debug
[1] 83945 abort PTDEBUG=1 pt-online-schema-change --alter="ADD COLUMN c1 INT" -u=user
System: macOS Sierra 10.12.3
Installed via brew (no special additional params)
DB System:
> mysql --version
mysql Ver 15.1 Distrib 10.2.4-MariaDB, for osx10.12 (x86_64) using readline 5.1
Perl:
> Perl --version
This is perl 5, version 18, subversion 2 (v5.18.2) built for darwin-thread-multi-2level
I tried with different alter statements, always the same result.
Any information missing?
regards,
Alex
debug message from percona tool: (schema, tablename and user replaced, user shoud have sufficient rights)
> PTDEBUG=1 pt-online-schema-change --alter="ADD COLUMN c1 INT" D=database,t=table -u=user
see attachment