Bad SQL Querie during PartyMode
#1
Hi all,

I was directed to this forum from openelec.tv support forum.
I have strange issue regarding my PI with openElec (Gotham) and Music PartyMode.

Here is the post I submitted. Hopefully someone here can give me an advise:

Quote:Hi all,

I usually try to solve issues on my own, but here I really need some more skilled support.
I tried Google and other Forums, but could not find any advice, that enhances my situation.

I have a PI and Openelec with XBMC Gotham (I did update via interface to latest stable release).
On a debian 24/7 Server I have a MySql instance which hosts the databases.
This setup worked fine in any situation, but suddenly the Party Mode of Music is broken. (I do not have any Musicvideos, simple Music Party Mode)

If I start Partymode the songs get randomly added to playlist. After some tracks (sometime after first - sometimes after 12 tracks), a popup apperas, that no tracks could be loaded from database and partymode gets aborted.

I enabled debug and could locate the "issue":
Code:
... GOT ANNOUNCEMENT, type: 2, from xbmc, message OnRemove
21:18:58 T:3058749440   DEBUG: GetRandomMusicVideo query = select * from musicvideoview where  order by RAND() limit 1
21:18:58 T:3058749440   ERROR: SQL: Undefined MySQL error: Code (1064)
                                            Query: select * from musicvideoview where  order by RAND() limit 1
21:18:58 T:3058749440   ERROR: GetRandomMusicVideo () failed
21:18:58 T:3058749440   DEBUG: ------ Window Init (DialogOK.xml) ------
21:18:58 T:2747262032   DEBUG: DoWork - Saving file state for audio item musicdb://songs/5223.mp3
21:19:02 T:2700076112    INFO: CFileCache::Process - Hit eof.
21:19:05 T:3058749440   DEBUG: SECTION:UnloadDelayed(DLL: special://xbmcbin/system/ImageLib-arm.so)
21:19:05 T:3058749440   DEBUG: Unloading: ImageLib-arm.so
21:19:28 T:2814579792   DEBUG: Thread JobWorker 2814579792 terminating (autodelete)
21:19:28 T:2747262032   DEBUG: Thread JobWorker 2747262032 terminating (autodelete)
21:20:32 T:3058749440   DEBUG: Keyboard: scancode: 0x1c, sym: 0x000d, unicode: 0x0000, modifier: 0x0
21:20:32 T:3058749440   DEBUG: OnKey: return (0xf00d) pressed, action is Select
21:20:32 T:3058749440   DEBUG: ------ Window Deinit (DialogOK.xml) ------
21:20:32 T:3058749440   ERROR: PARTY MODE MANAGER: Cannot get songs from database. Aborting.

I do not know why, but the system tries to fetch a random music video and for that it uses a bad querie (Query: select * from musicvideoview where order by RAND() limit 1). The attribute ID is completly missing and this causes the SQL querie to fail and Partymode get aborted.

I have dropped all databases, Updated to a Beta OpenELEC, added real content to musicvideoview database, but I still get the issue - sometimes after first track, sometimes after 10 tracks.

I am completly lost, as I could identify the issue but do not know how to solve. I guess this querie is somewhere hard coded ??
The databases and especially the tables are all fine.

Does someone have a similiar issue or could advise, how to solve this?

Many thanks in advance,
Alex

In the meantime I solved the issue by resetting to factory default, but I wondering what happend there and especially if I can modify the SQL queries by my own (without compiling an own setup)?

Many thanks in advance,
Alex
Reply
#2
It's unlikely to be a Raspberry Pi specific issue, you'd have more luck posting your query in the general section where more developers may be lurking.

Perhaps a mod could move your post.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
#3
moved
Reply
#4
Code:
select * from musicvideoview where  order by RAND() limit 1

There is no where clause there. This is an issue as that SQL is invalid.

I presume whereClause.second is somehow empty in
https://github.com/xbmc/xbmc/blob/7b8fcd...r.cpp#L401
Reply
#5
Hi and thanks for move and replies.

I assumed as well, that there are somewhere some empty arguments.
Now I know, that the PartyModeManager sources could cause the "bad" Querie.

Is it possible, that there was a problem with the "history" elements:

Code:
std::string historyWhereVideo;
  if (!historyItemsVideo.empty())
  {
    if (!m_strCurrentFilterVideo.empty())
      historyWhereVideo = m_strCurrentFilterVideo + " and ";
    historyWhereVideo += "idMVideo not in (" + StringUtils::Join(historyItemsVideo, ", ") + ")";
  }
....
return make_pair(historyWhereMusic, historyWhereVideo);

For my understanding, the value that gets interpreted is historyWhereVideo, but this value gets filled only if (!historyItemsVideo.empty()).
I guess here could be the issue, but to go on a "deep dive" would be to much effort. Maybe If I have some spare time Big Grin.

Nevertheless, as mentioned, partymode now works fine again and thanks to the issue, I gathered deeper knowledge of XBMC structure Big Grin.

Regards,
Alex
Reply
#6
I'll pass this on to @jmarshall, maybe he missed something
Reply
#7
Has this been resolved? I'm having this exact same issue. I'm on Kodi 14.0 final.

In my logs I see the SQL error and GetRandomMusicVideo () failed

Steps to repeat for me:

Start Party Mode (from the left Nav while in the Music section)
It successfully fills a few songs
Error pops up after it plays said songs and needs to "refill"
Reply
#8
I was able to reproduce it. c5ebee0f7009d531d9584eec7ad724b2b15e7df9 should fix the issue.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply

Logout Mark Read Team Forum Stats Members Help
Bad SQL Querie during PartyMode0