Problem with mysqldatabase and Jsonrpc ?
#1
Hi all.

I've migrated my library to mysql database and saw something wrong with jsonrpc interface.
I'm using SVN 35110M and linux 32 bit os ( debian )

If I use normal sqlite database everything is ok, but when i switch to mysql one, I can't get movie listing with web interfaces. Same bug with Normal and AWX.

I can't sort movies/tvshows.

My music database is still sqlite and it sorts them ok.

What's strange is json seems to sort ok but the webinterface still shows loading icon and don't sort anything:

Here is an example of what json answer on tvshow listing request:

pastebin here: http://pastebin.com/yNwW3wx3


Xbmc log when we query tv show listing:

Code:
13:22:30 T:2873383792 M:853225472   DEBUG: GetTvShowsByWhere query: SELECT tvshow.*,path.strPath AS strPath,counts.totalcount AS totalCount,counts.watchedcount AS watchedCount,counts.totalcount=counts.watchedcount AS watched FROM tvshow JOIN tvshowlinkpath ON tvshow.idShow=tvshowlinkpath.idShow JOIN path ON path.idpath=tvshowlinkpath.idPath LEFT OUTER join (    SELECT tvshow.idShow AS idShow,count(1) AS totalcount,count(files.playCount) AS watchedcount FROM tvshow     JOIN tvshowlinkepisode ON tvshow.idShow=tvshowlinkepisode.idShow     JOIN episode ON episode.idEpisode=tvshowlinkepisode.idEpisode     JOIN files ON files.idFile=episode.idFile     GROUP BY tvshow.idShow) counts ON tvshow.idShow=counts.idShow
13:22:30 T:2873383792 M:853225472   DEBUG: Time for actual SQL query = 0
13:22:30 T:2873383792 M:853225472   DEBUG: Time to retrieve tvshows from dataset = 3

Is it a known problem ?
Reply
#2
what exactly IS the problem? start there. you don't get movies listed or they don't sort or what?
Reply
#3
Could you please explain more thoroughly, I don't really understand the problem
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#4
Ok I start again. My title is not really accurate in fact, as it seems to be a javascript lib problem.

Xbmc Dharma beta 4 or SVN, same result.

2 cases:

case 1) using xbmc internal sqlite database
case 2) using xbmc with mysql database

Now testing the web interface on http://xbmc:8080/ ( default one )
and trying to get tv Shows by clicking on Tv Show button ( same problem with movies either )

case 1) It list the tv shows.
case 2) It won't. Loading icon is rolling forever.

Using Firebug, i can see xbmc json answer after getTvShows call, and it seems ok .

xbmc answer of GetTVShows query passed after clicking on Tv Show button, using mysql, here:

http://pastebin.com/yNwW3wx3

Seems ok apparently in comparaison to the same with sqlite:

http://pastebin.com/MvFm20gm


There's exactly the same problem with AWX addon. But it uses the same javascript lib I think.

The only error I could catch on firebug console is this one when you load the page, but it doesn't seems to be related.

Code:
uncaught exception: [Exception... "Not enough arguments"  nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)"  location: "JS frame :: http://mediacenter:8080/js/Core.js?0.30374964506282687 :: applyDeviceFixes :: line 55"  data: no]

Line 0
Reply
#5
Something strange in firebug. With the faulty one ( mysql ), there's no Json tab, right of the "answer" tab ( "Réponse" in my screenshot )


Working one ( sqlite ) , you can see the last tab called "JSON"

Image

Not Working one ( mysql ) : no Json tab, only the answer one ( with json inside ).

Image

In general I experienced this firebug behavior when the json data are faulty.

Headers are correct:

Date Wed, 03 Nov 2010 16:49:00 GMT
Content-Length 16495
Content-Type application/json
Keep-Alive timeout=15, max=37
Connection Keep-Alive




EDIT:

I think I've spotted the culprit.

Look at the rating fields in mysql case:

"rating" : 9,000000000000000,

They're all have the second "000000000000000," arguments instead of one on the working case:

"rating" : 9.0,

That breaks json data for sure.

So I've checked in my sql database, the rating field seems to be "c04" for TV and "c05" for Movies. Data are stored in decimal like this:
9.000000 .

Doesn't this field supposed to be integer only ?

So when exported it transforms the value as 9,0000000 and client can't parse the json data.

I've changed the related c04 and c05 fields in the video database from TXT to TINYINT and now everything works OK.
Reply
#6
in fact, it didn't solved completly. If i navigate on my movie/tv library on tv, and then i come back on the web interface, the problem come back again.

My rating fields are forced to TINYINT but it answers again:
"rating" : 9,000000000000000,

But it's still plain integer value in the database. °0
Reply
#7
Shameless selfbump.
Reply
#8
Nice spotting of the rating difference, that would clearly fuck up the json parsers. How it happens though I have NOOOO idea, it really shouldn't. Looking at it though

EDIT: Could you try http://pastebin.ca/1981697
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#9
this seems to do the trick. I'm testing remotely for the moment but it works.

I'll confirm you after more test @Home.

Thanks a lot mate.
Reply
#10
Please do, and it would be awesome if you could try both of these aswell

result["rating"] = Value((double)videoInfo->m_fRating);

result["rating"] = static_cast<double>(videoInfo->m_fRating);

To make sure whichc of them actually did it so I know if there might be other uncovered bugs Smile
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#11
ok tried all of them , and all 3 are working ok. It seems strange to me.

But I'm still at the office now.

I'll need to test by browsing manually the library before requesting it from the webinterface, because each time i restart xbmc it works first, and then after browsing the lib, the problem is back.
Reply
#12
Could test live now.

Sadly none of the solution works. Sad

Here are new infos on the problem:

After a fresh xbmc start: ratings data requested from json are ok ( 8.0 )
If i go from the xbmc menu inside TvShow or movies, then after, all ratings data requested from json are bad ( 8,0000000 )

edit: I've added my xbmc.log if it can help: http://pastebin.com/HYp8eg4X
In the logfile: First i gettvshows from web interface after xbmc start. ( works ). Then i browse my Tv Show lib on my TV. Then I gettvshows again from web interface ( don't work)
Reply
#13
I had the same problem with the webinterface not working correctly due to the wrong formating of the rating values.

I just found that the problem is related to the locale settings. If i start xbmc with "LC_NUMERIC=C xbmc" the problem disappears and the webinterfaces (AWX and default) shows movies and tv shows.

P.S.: Did something in the handling of locale settings changed between beta2 and beta4. I am pretty sure, that I didnt had this problem before upgrading to beta4.
Reply
#14
Pretty interesting.

So if i export set LC_NUMERIC=C before launching xbmc i confirm everything works flawlessly.

Thanks for the info PanamaJack.
Reply
#15
Hmm, so the problem is in the json writer, i.e. line 70 and 72 in lib/jsoncpp/jsoncpp/src/lib_json/json_writer.cpp.

I'll take a look, but if anyone spots something there please ping Smile

EDIT: Fixed, not a pretty fix but should be fixed. Will backport to dharma
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply

Logout Mark Read Team Forum Stats Members Help
Problem with mysqldatabase and Jsonrpc ?0