Kodi Community Forum
Solved An unknown error occurred in SQL - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228)
+---- Thread: Solved An unknown error occurred in SQL (/showthread.php?tid=366145)

Pages: 1 2


RE: An unknown error occurred in SQL - mara.pavelka - 2021-12-28

Link to the db: <link obscured>


RE: An unknown error occurred in SQL - black_eagle - 2021-12-28

(2021-12-28, 10:02)mara.pavelka Wrote: You're right, it definitely looks like a problem with the existing database. Or with the container, because I tried deleting and recreating the relevant databases for Kodi, but that didn't help.

Now I tried using the newly installed container from official mariadb and everything works fine.

It has to be the container that you were using then.  There is nothing wrong with that exported db.  I imported it into Mariadb 10.0.38 and ran a bunch of the queries that were failing in your logs and they all executed fine. As a quick example, this query failed for you.
sql:
SELECT art_id,url FROM art WHERE media_id=271 AND media_type='movie' AND type='thumb';
It didn't fail here though.

sql:
+--------+-------------------------------------------------------------------------------------------------------------------------------+
| art_id | url                                                                                                                           |
+--------+-------------------------------------------------------------------------------------------------------------------------------+
|  15235 | image://video@smb%3a%2f%2fOMV5%2fFilmy3%2fFilmy%20HD%202%2fOld%20Henry%20(2021)%2fOld.Henry.2021.1080p.WEBRip.DD5.1.x264.mkv/ |
+--------+-------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.03 sec)

Do I take it that using the official container is a solution you're happy with ?


RE: An unknown error occurred in SQL - CaptainTivo - 2021-12-31

So, I had the exact same problem.  I have 2 PC's and 4 Fire TV cubes running Kodi with a shared database on a  MariaDB docker on Unraid for about 5 years.  This week I broke a rule ("If it ain't broke, don't fix it!") and updated the MariaDB docker to the latest version (10.5.13).  When I tried to launch Kodi on a Fire TV cube, it hung on the initial splash page.  However, Kodi continued to work fine on the PCs.  Checking the log, I see a ton of the same types of errors:
"2021-12-29 15:01:47.639 T:1490   ERROR: SQL: [MyVideos116] An unknown error occurred Query: select count(1) from movie"

I was trying to find a way to revert to an older version of MariaDB when I chanced on this thread.  I edited the custom.cnf file to increase the sort_buffer_size to 10M.
Voila, the Kodi installations on the Fire TV's work again.

My question is: why?  I mean, why would changing a parameter on the database server affect the Kodi (client)?  Especially since the Kodi installs on the PC's still worked?
Also, (and this may be a question for Unraid experts) will the "fix" of editing the custom.cnf file persist?

I logged into the mariadb server using HeidiSQL and  tried running your test query: 
"SELECT art_id,url FROM art WHERE media_id=271 AND media_type='movie' AND type='thumb';"

but it returned no data:
Quote:/* Connecting to 192.168.1.3 via MariaDB (TCP/IP), username xbmc, using password: Yes ... */
SELECT CONNECTION_ID();
/* Connected. Thread-ID: 178 */
/* Characterset: utf8mb4 */
SHOW STATUS;
SELECT NOW();
SHOW VARIABLES;
USE `MyVideos116`;
SELECT art_id,url FROM art WHERE media_id=271 AND media_type='movie' AND type='thumb';
/* Affected rows: 0  Found rows: 0  Warnings: 0  Duration for 1 query: 0.000 sec. */

Does this mean anything?

Thanks for any help.


RE: An unknown error occurred in SQL - black_eagle - 2021-12-31

(2021-12-31, 21:48)CaptainTivo Wrote: My question is: why?  I mean, why would changing a parameter on the database server affect the Kodi (client)?  Especially since the Kodi installs on the PC's still worked?

Because the query is run on the server, not the client.  The client just gets returned the result.
 
(2021-12-31, 21:48)CaptainTivo Wrote: Does this mean anything?

Means you don't have a media_id of 271, that's all.
 
(2021-12-31, 21:48)CaptainTivo Wrote: Also, (and this may be a question for Unraid experts) will the "fix" of editing the custom.cnf file persist?

See no reason why it shouldn't.


RE: An unknown error occurred in SQL - CaptainTivo - 2022-01-01

Quote:Because the query is run on the server, not the client.  The client just gets returned the result.
But that is exactly why it shouldn't matter.  If the server runs the same code, regardless of which client sent the query, then all clients should have the same problem (i.e. getting the same error from the server).

I confess almost complete ignorance of data bases and mysql.  I did look up sort_buffer_size  here: https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html but I don't understand most of it so my confusion comes solely from logic. If the variable used by the server is the same for all clients, then why is there a difference in behavior for different clients?  In, fact, why do queries from a PC installation succeed where those from the Fire TV Android installations fail? If the server is configured incorrectly for this particular database, shouldn't it fail for all client queries?

Also, what exactly is it in the updated server code that caused this to manifest itself in the first place?  Is this a bug in the new code that was not in the older versions?  Sorry to be so persistent but I really would like to understand, even if the answer is "you need to learn mysql server code in depth to understand it".


RE: An unknown error occurred in SQL - mara.pavelka - 2022-01-05

(2021-12-28, 18:00)black_eagle Wrote: Do I take it that using the official container is a solution you're happy with ?

Sorry for the late reply, I've been troubleshooting some other issues and mainly testing Kodi more thoroughly with the official container. It looks like the database problems were caused by the Nextcloud installation. For now it looks like I'll have to use the official container for Kodi and Linuxserver container for the other stuff. I can't say I'm completely happy with this solution, I'd rather use one database for everything, but it works for now, so I'll leave it at that. Thanks for your help. Smile


RE: An unknown error occurred in SQL - CaptainTivo - 2022-02-26

Replying to own post.
I have resolved the problem and it has nothing to do with the configuration.  What happened is that I updated my mariadb server docker container on my Unraid machine.
Apparently, the upgrade to the mariadb version resulted in incompatibilities with the the Kodi database that I have been running.  There is a mysql utility specifically for this: mysql_update.  Link here: https://mariadb.com/kb/en/mysql_upgrade/

I ran this command on the mariadb console:   mysql_upgrade -u root -p 
which resulted in a lot of output of the form:
Quote:MyVideos116.episode_view                           OK
MyVideos116.movie_view                             OK
MyVideos116.musicvideo_view                        OK
MyVideos116.season_view                            OK
MyVideos116.tvshow_view                            OK
MyVideos116.tvshowcounts                           OK
MyVideos116.tvshowlinkpath_minview                 OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
Processing databases
MyVideos107.uniqueid                               OK
MyVideos107.writer_link                            OK
Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
root@b26ff4f84b66:/# 

After that, all of my Kodi clients worked fine and I found no errors in the log files.
There is still one mystery though: why did my PC Kodi clients still work after the update and all my Android clients failed?  After all, the problem was with the actual database and the inability of that version of mariadb to use that database without the update.  I would still like and answer to that question.


RE: An unknown error occurred in SQL - DaveBlake - 2022-03-03

Glad you found the MariaDB issue and solved this @CaptainTivo
(2022-02-26, 20:42)CaptainTivo Wrote: There is still one mystery though: why did my PC Kodi clients still work after the update and all my Android clients failed?  After all, the problem was with the actual database and the inability of that version of mariadb to use that database without the update.  I would still like and answer to that question.
The differences in Windows and Android are many... My guess would be it was related to the MariaDB connector DLL that sits client side, these will be different implementations on Windows and Android. One coped with whatever way the server side of things was different while the other didn't. This kind of server version, hardware, OS variation is one reason why MariaDB/MySQL use in Kodi remains labelled as "experimental", there is just no way we could take on testing all the possible system combinations.


RE: An unknown error occurred in SQL - CaptainTivo - 2022-03-03

(2022-03-03, 19:08)DaveBlake Wrote: Glad you found the MariaDB issue and solved this @CaptainTivo
(2022-02-26, 20:42)CaptainTivo Wrote: There is still one mystery though: why did my PC Kodi clients still work after the update and all my Android clients failed?  After all, the problem was with the actual database and the inability of that version of mariadb to use that database without the update.  I would still like and answer to that question.
The differences in Windows and Android are many... My guess would be it was related to the MariaDB connector DLL that sits client side, these will be different implementations on Windows and Android. One coped with whatever way the server side of things was different while the other didn't. This kind of server version, hardware, OS variation is one reason why MariaDB/MySQL use in Kodi remains labelled as "experimental", there is just no way we could take on testing all the possible system combinations.

Ah, that makes sense.  Of course, you guys use client code from the Mariadb project.  I was under the mistaken notion that you wrote that yourselves.