[MDEV-8525] mariadb 10.0.20 crashing when data is read by Kodi media center (http://kodi.tv). Created: 2015-07-22 Updated: 2018-05-30 Resolved: 2015-10-28 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Subquery |
| Affects Version/s: | 10.0, 10.1 |
| Fix Version/s: | 10.0.22, 10.1.9 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Dave M. | Assignee: | Oleksandr Byelkin |
| Resolution: | Fixed | Votes: | 5 |
| Labels: | None | ||
| Environment: |
Archlinux 4.1.2-2-ARCH, mariadb 10.0.20-1 |
||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Sprint: | 10.1.9-1 | ||||||||||||||||
| Description |
|
Reported the problem here: http://trac.kodi.tv/ticket/16126 and here: http://forum.kodi.tv/showthread.php?tid=232834 Mariadb seems to crash when data is read?! by Kodi Attached is journalctl output of the crash plus a logfile of Kodi. |
| Comments |
| Comment by asavah [ 2015-07-23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Just stumbled into this issue. The query thats crashes mariadb server:
Surprisingly removing ORDER BY succeeds.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by mccurly [ 2015-07-24 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@asavah Thanks for reporting this. I am also afflicted by this issue. Since I am a beginner in mysql and mariadb, could you please tell me how did you find what was the instruction that was crashing the server? I have some spare time now and I can help in finding out more details about this disrupting issue, if, of course, you feel that it isn't much of a bother. I could also learn along the way. Thanks in advance. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2015-07-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Can any of you provide a dump of the involved tables? The visible ones are albumview and albumartistview, but if they are really views, there will be underlying tables, we need them as well. The dump can be uploaded to ftp.askmonty.org/private, only MariaDB developers will have access to it.
Thanks. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by mccurly [ 2015-07-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hello, Unfortunately I have downgraded kodi to 14.2 version where this is not apparent. But I tried to reproduce the facts and I found out that kodi v.15 errors out at this point:
The /run/mysqld/mysqld.sock socket file exists and It is recognized as such. These may be important from the mariadb my.cnf file:
Also, this is my mysqld log
Hope it can be of some use. Yours | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dave M. [ 2015-07-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by asavah [ 2015-07-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Uploaded full dump rpi2_music53.sql.gz as requested. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by mccurly [ 2015-07-28 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hello. Unfortunately, I don't have much/any feedback to give as of yet. I am currently using mysql from oracle. With their version of sql this problem doesn't occur. I am sure this problem affects others. Were any changes made to mariadb and/or any of it's dependencies? If so I am willing to try them out again. Yours. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2015-07-29 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks a lot, with the provided dump I can reproduce the issue. Do I understand correctly that the table structures (column names, indexes and such) come from the media center and thus are public, and only the data should be kept private? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by asavah [ 2015-07-29 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Yes. Kodi mysql logic is here: https://github.com/xbmc/xbmc/blob/4b122b1eaf97de975ee199eb702123be408ee86e/xbmc/dbwrappers/mysqldataset.cpp | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2015-07-30 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Note: it's exactly the same data structures and query as provided, I only obfuscated the data. The views at least can be simplified, but I intentionally leave them as is to be sure that the initial problem gets fixed rather than some variation of it. The problem appeared in 10.0 tree some time between 10.0.17 and 10.0.18 releases. I could not find the exact revision that caused it, my search led to the merge 5.5=>10.0, but it's not reproducible on 5.5, so the further search got stuck. Still, I set 'fix version' to 5.5 in case it originates from there. Please adjust if needed. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2015-10-23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
EXPLAIN works:
The query itself crashes in top-level select, when trying to switch to reading from the temporary table. It searches for the temp. table item for
and the item returns NULL. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2015-10-23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The temporary table actually has an item for the subquery:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2015-10-23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
... However, both Item_direct_view_ref and Item_singlerow_subselect have result_field=NULL. result_field is set in create_tmp_table. create_tmp_table has this code:
We arrive to "We don't have to store this" for all items in albumview.*, including the iTimesPlayed subquery. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2015-10-23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Items in the other table are also Item_direct_view objects, and create_tmp_table will call set_result_field for them:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2015-10-23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
.. however, change_refs_to_tmp_fields() seems to ignore the above difference. It has a loop that just goes through all items. Need to discuss this with sanja. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-10-28 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
revision-id: ad9ed479ab2cb711ce2b0de01f91eb03dfd0c4d6 (mariadb-10.0.21-59-gad9ed47)
Item_direct_view_ref maintains its own item_const() method so should use it when asked of temporary table field to be in sync with it. — | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2015-10-28 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Ok to push. I think we should ask elenst to make a test pass with RQG and relevant test load: queries with ORDER BY/GROUP BY/DISTINCT . |