[MDEV-5037] Server crash on a JOIN on a derived table with join_cache_level > 2 Created: 2013-09-19 Updated: 2013-09-23 Resolved: 2013-09-23 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 5.5.32, 5.5.33 |
| Fix Version/s: | 5.5.34 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Jean Weisbuch | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | crash, join, optimizer | ||
| Environment: |
Debian Squeeze amd64 5.5.32 & Debian Squeeze amd64 5.5.33 |
||
| Attachments: |
|
| Description |
|
While the join_cache_level variable is set to a value > 2, a query with a join on a derived table with a TEXT column in it could result to a server crash when LIMIT x OFFSET x is used on the derived table. To reproduce the crash, import the attached SQL then execute the following query :
Here is the error log output :
|
| Comments |
| Comment by Sergei Petrunia [ 2013-09-20 ] |
|
Program received signal SIGSEGV, Segmentation fault. up #4 0x00000000006524fe in check_join_cache_usage (tab=0x7fffb4c62800, options=4, no_jbuf_after=2, table_index=1, prev_tab=0x7fffb4c624e0) at /home/psergey/dev2/5.5/sql/sql_select.cc:9798 (gdb) list (gdb) p tab->table (gdb) p tab->table->alias.Ptr |
| Comment by Sergei Petrunia [ 2013-09-20 ] |
|
(gdb) p tab->table->file->table So, table->file->multi_range_read_info() is called on a temporary table. The temporary table has handler::table==NULL. This causes a crash in DS-MRR implementation (DS-MRR needs various information from TABLE object, e.g. it needs information about whether a clustered key is present) |
| Comment by Sergei Petrunia [ 2013-09-20 ] |
|
For regular tables, handler::table is assigned here: #0 handler::ha_open As for the temporary table, it is created by the create_tmp_table( .... do_not_open= true, ...) call. When do_not_open==true, the table is created but not opened. handler::handler() accepts a TABLE_SHARE argument. A temporary table will handler::ha_open will be called for the temporary table from here: #0 handler::ha_open |
| Comment by Sergei Petrunia [ 2013-09-20 ] |
|
Directions for the solution (not sure if all of them are actually feasible): 1. Make handler::table be assigned in hander::handler(), not when the table is 2. Make DsMrr_impl::dsmrr_info() only access the TABLE_SHARE, not TABLE object. 3. Disable DS-MRR for temporary tables (at least, for those that don't have a |
| Comment by Sergei Petrunia [ 2013-09-20 ] |
|
The patch is here: http://lists.askmonty.org/pipermail/commits/2013-September/005411.html |
| Comment by Sergei Petrunia [ 2013-09-23 ] |
|
Fix pushed. |