[MDEV-3121] LP:623209 - Crash in JOIN_CACHE::get_offset with join_cache_level=6 in maria 5.3 Created: 2010-08-24 Updated: 2015-02-02 Resolved: 2012-10-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Philip Stoev (Inactive) | Assignee: | Igor Babaev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
The following query: SELECT MAX( table2 . `col_varchar_key` ) AS field1 FROM ( C AS table1 STRAIGHT_JOIN ( ( B AS table2 RIGHT JOIN CC AS table3 ON (( table3 .`pk` > table2 . `pk` ) AND (table3 .`pk` <= table2 . `col_int_key` ) ) ) ) ON (( table3 . `col_varchar_key` = table2 . `col_varchar_nokey` ) AND ( table3 . `pk` = table2 . `col_int_key` ) ) ) HAVING field1 <= 'm'; causes the following crash:
bzr version-info: revision-id: <email address hidden> |
| Comments |
| Comment by Philip Stoev (Inactive) [ 2010-08-24 ] | ||||||||||||||||||||||||||||||||||||||||
|
Re: Crash in JOIN_CACHE::get_offset with join_cache_level=6 in maria 5.3-dsmrr-cpk --source include/have_innodb.inc SET SESSION join_cache_level=6; CREATE TABLE `CC` ( SELECT table2 .`col_varchar_key` | ||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2010-09-04 ] | ||||||||||||||||||||||||||||||||||||||||
|
Re: Crash in JOIN_CACHE::get_offset with join_cache_level=6 in maria 5.3-dsmrr-cpk ==12613== Thread 23: | ||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2010-09-15 ] | ||||||||||||||||||||||||||||||||||||||||
|
Re: Crash in JOIN_CACHE::get_offset with join_cache_level=6 in maria 5.3-dsmrr-cpk ---
---
--- | ||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2010-09-15 ] | ||||||||||||||||||||||||||||||||||||||||
|
Re: Crash in JOIN_CACHE::get_offset with join_cache_level=6 in maria 5.3-dsmrr-cpk MariaDB [dsm1]> alter table CC add key(pk); and force the table2,C,table3 join order in the query: MariaDB [dsm1]> explain SELECT table2 .`col_varchar_key` FROM B table2 STRAIGHT_JOIN C STRAIGHT_JOIN CC table3 force index(pk) WHERE table2 .`pk` AND table3 .`col_varchar_key` AND table3 .`pk` = table2 .`col_int_key`;
---
--- Then, put a breakpoint at bka_range_seq_next(): Breakpoint 1, bka_range_seq_next (rseq=0xb1246f0, range=0xb124858) at sql_join_cache.cc:2173 And run the SELECT: MariaDB [dsm1]> SELECT table2 .`col_varchar_key` FROM B table2 STRAIGHT_JOIN C STRAIGHT_JOIN CC table3 force index(pk) WHERE table2 .`pk` AND table3 .`col_varchar_key` AND table3 .`pk` = table2 .`col_int_key`; When the breakpoint is hit, we can observe that join buffer has two records: JOIN_CACHE_BKA::get_next_key (this=0xb1246f0, key=0xb124858) at sql_join_cache.cc:2464 Continue execution two times, so that we're stopped in the 3rd invocation of bka_range_seq_next(). (gdb) c Breakpoint 1, bka_range_seq_next (rseq=0xb1246f0, range=0xb124858) at sql_join_cache.cc:2173 Breakpoint 1, bka_range_seq_next (rseq=0xb1246f0, range=0xb124858) at sql_join_cache.cc:2173 At this point, one would expect that bka_range_seq_next() returns EOF, since all records in the buffer have already been enumerated. (gdb) next Remember this pointer ^^^^^^ (gdb) down Now, we see that JOIN_CACHE_BKA::pos points to BKA's rowids buffer (which contains uninitialized data because we haven't written any rowids to it yet). Yet, if we continue execution we see attempts to read the uninitialized data: (gdb) next At this point we're processing apparent garbage. We happen to avoid crash in 5.3-main but crash in 5.3-dsmrr-cpk (because it writes key values at the start of the buffer, which causes join cache code to read different garbage values). | ||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2010-09-15 ] | ||||||||||||||||||||||||||||||||||||||||
|
Re: Crash in JOIN_CACHE::get_offset with join_cache_level=6 in maria 5.3-dsmrr-cpk | ||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2010-09-15 ] | ||||||||||||||||||||||||||||||||||||||||
|
Re: Crash in JOIN_CACHE::get_offset with join_cache_level=6 in maria 5.3-dsmrr-cpk | ||||||||||||||||||||||||||||||||||||||||
| Comment by Rasmus Johansson (Inactive) [ 2011-12-13 ] | ||||||||||||||||||||||||||||||||||||||||
|
Launchpad bug id: 623209 |