[MDEV-16803] select on a view crash the server Created: 2018-07-23 Updated: 2018-08-27 Resolved: 2018-08-27 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Subquery |
| Affects Version/s: | 10.2.16 |
| Fix Version/s: | 10.2.18 |
| Type: | Bug | Priority: | Major |
| Reporter: | Marc | Assignee: | Galina Shalygina (Inactive) |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Linux version 2.6.32-754.2.1.el6.x86_64 (mockbuild@x86-031.build.eng.bos.redhat.com) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC) ) #1 SMP Tue Jul 3 16:37:52 EDT 2018 |
||
| Attachments: |
|
| Description |
|
A select on a view crash the server 10.2.16. It works on 10.2.14. The original query and view is more complex than the test case but backtraces are identical as you can see in files attached. Test case:
|
| Comments |
| Comment by Elena Stepanova [ 2018-07-23 ] | ||||||||||||||||||||||||||||||||||
|
Thanks a lot for the report and test case.
The problem appeared in 10.2 tree with this commit:
| ||||||||||||||||||||||||||||||||||
| Comment by Galina Shalygina (Inactive) [ 2018-08-01 ] | ||||||||||||||||||||||||||||||||||
|
The bug appears in the cleanup process in the pushdown into the materialized view/derived table. The query above uses view that is defined with two SELECT statements. For each SELECT that defines derived table for the condition that can be pushed a clone is created. When first SELECT is processed the cleanup() method calls 'delete array' for the Item_func_in element. It empties 'comparators' array in the 'array' structure. The condition that can be pushed into the second SELECT has the same 'array' link. When cleanup() is called for this condition it tries to reach already lame 'array' and that causes a crash. So after the first cleanup() call this link becomes lame. The bug occurs because of the wrong build_clone() method work for the Item_func_in items. To build the 'array' field for the clone Item_func_in::create_array() method is called there. It can be seen that for the case when the result type of the Item_func_in item is ROW_RESULT no 'array' is initialized in the create_array() method. It is implied that 'array' was created before the call of the create_array() method. It can be seen that the only method where create_array() call occurs is Item_func_in::fix_length_and_dec(). In this method 'array' is created for the case when the result type is ROW_RESULT before the create_array() call. Also there 'cmp_items' array is filled with appropriate values. In Item_func_in::build_clone() method this array is filled with 0. Therefore it was also a mistake and in some cases that can cause a bug. To make build_clone() method work right create_array() call should be changed on fix_length_and_dec() call. | ||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2018-08-03 ] | ||||||||||||||||||||||||||||||||||
|
Ok to push | ||||||||||||||||||||||||||||||||||
| Comment by Galina Shalygina (Inactive) [ 2018-08-27 ] | ||||||||||||||||||||||||||||||||||
|
Pushed in 10.2 |