Percona Server 5.1.58 crashes on a specific query

Bug #905711 reported by Ovais Tariq
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
Percona Server moved to https://jira.percona.com/projects/PS
Fix Released
Undecided
Laurynas Biveinis
5.1
Fix Released
Undecided
Laurynas Biveinis

Bug Description

FYI, this bug also affects MySQL vanilla release version 5.1.58. However this bug does not seem to affect Percona Server 5.5.15

=== Version info

mysql [localhost] {msandbox} (crash_test) > select version();
+---------------+
| version() |
+---------------+
| 5.1.58rel12.9 |
+---------------+

=== Table structure that produces a crash

CREATE TABLE `crash_tbl` (
  `id` varchar(32) NOT NULL,
  `customer_name` varchar(50) NOT NULL COMMENT 'account name',
  `tenant_id` varchar(32) NOT NULL COMMENT 'Save Tenant id',
  `deleted` bit(1) DEFAULT b'0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

=== Query that produces the crash

select id from crash_tbl
where tenant_id='10513' and deleted=0
and
(
    customer_name='asmith' and cast(customer_name as binary)=x'61736D697468'
or
    customer_name='bsmith' and cast(customer_name as binary)=x'62736D697468' and customer_name='esmith' and cast(customer_name as binary)=x'65736D697468'
);

=== Relevant text from error log

111217 9:56:15 - 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.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=8384512
read_buffer_size=131072
max_used_connections=1
max_threads=151
threads_connected=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 338413 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x586a7b0
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 = 0x41b520e8 thread_stack 0x40000
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld(my_print_stacktrace+0x39)[0x88e1c9]
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld(handle_segfault+0x34e)[0x5bda4e]
/lib64/libpthread.so.0[0x34be60eb70]
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld[0x623ce9]
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld[0x623c91]
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld[0x6242e2]
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld[0x624348]
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld[0x624348]
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld[0x624348]
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld[0x627c0a]
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld(_ZN4JOIN8optimizeEv+0x1bc)[0x6317cc]
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld(_Z12mysql_selectP3THDPPP4ItemP10TABLE_LISTjR4ListIS1_ES2_jP8st_orderSB_S2_SB_yP13select_resultP18st_select_lex_unitP13st_select_lex+0xd2)[0x63b052]
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld(_Z13handle_selectP3THDP6st_lexP13select_resultm+0x1c5)[0x63ba45]
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld[0x5c6ee1]
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld(_Z21mysql_execute_commandP3THD+0x3c6)[0x5c9da6]
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld(_Z11mysql_parseP3THDPcjPPKc+0x51b)[0x5cffcb]
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x9f1)[0x5d09c1]
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld(_Z10do_commandP3THD+0x129)[0x5d1649]
/usr/local/mysql-sandboxes/percona-server/5.1.58/libexec/mysqld(handle_one_connection+0x9ce)[0x5c36ce]
/lib64/libpthread.so.0[0x34be60673d]
/lib64/libc.so.6(clone+0x6d)[0x34bd6d44bd]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x5892a00): select id from crash_tbl where tenant_id='10513' and deleted=0 and ( customer_name='asmith' and cast(customer_name as binary)=x'61736D697468' or customer_name='bsmith' and cast(customer_name as binary)=x'62736D697468' and customer_name='esmith' and cast(customer_name as binary)=x'65736D697468' )
Connection ID (thread ID): 1
Status: NOT_KILLED

Related branches

Revision history for this message
Ovais Tariq (ovais-tariq) wrote :
Revision history for this message
Oleg Tsarev (tsarev) wrote :

Ovais,

Does it reproduce on upstream MySQL 5.1.58?

Changed in percona-server:
status: New → Incomplete
status: Incomplete → New
Revision history for this message
Oleg Tsarev (tsarev) wrote :

Please ignore my comment, missed the begin of bug description

Changed in percona-server:
assignee: nobody → Laurynas Biveinis (laurynas-biveinis)
Changed in percona-server:
status: New → In Progress
milestone: none → 5.1.61-13.2
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Minimal testcase:

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

CREATE TABLE t1 (a VARCHAR(50));

SELECT a FROM t1 WHERE CAST(a as binary)=x'62736D697468' AND CAST(a AS BINARY)=x'65736D697468';

DROP TABLE t1;

Changed in percona-server:
status: In Progress → Fix Committed
Changed in percona-server:
status: Fix Committed → Fix Released
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-2714

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.