XBMC lockup after suspend when using MySQL
#1
I am experiencing problems after waking up from standby when using a MySQL database. Sometimes the XBMC-GUI locks up then.
I connected gdb to the locked up process and it seems like the current window was having an open network connection to the MySQL server. That connection was not accessible anymore after wake up which caused a block.

Code:
#0  0x00007f32e52505ed in read () at ../sysdeps/unix/syscall-template.S:81
81      ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) bt
#0  0x00007f32e52505ed in read () at ../sysdeps/unix/syscall-template.S:81
#1  0x0000000000f2bdf1 in vio_read (vio=<optimized out>, buf=<optimized out>, size=<optimized out>) at viosocket.c:54
#2  0x0000000000f2b6fb in vio_read_buff.part.0 (size=4, buf=0x6ff4240 ":", vio=0x6fe5200) at viosocket.c:93
#3  vio_read_buff (vio=0x6fe5200, buf=0x6ff4240 ":", size=4) at viosocket.c:72
#4  0x0000000000f5cffb in my_real_read (net=net@entry=0x4bc2090, complen=complen@entry=0x7fff7c8142f8) at net.c:816
#5  0x0000000000f5d1fc in my_net_read (net=net@entry=0x4bc2090) at net.c:1011
#6  0x0000000000f5e5be in cli_safe_read (mysql=mysql@entry=0x4bc2090) at client.c:693
#7  0x0000000000edeae0 in cli_read_query_result (mysql=0x4bc2090) at client.c:2827
#8  0x0000000000edd2b6 in mysql_real_query.part.5 (mysql=0x4bc2090) at client.c:2931
#9  mysql_real_query (mysql=0x4bc2090, query=<optimized out>, length=<optimized out>) at client.c:2923
#10 0x0000000000821de3 in dbiplus::MysqlDatabase::query_with_reconnect (this=0x6e5a030, query=<optimized out>, query@entry=0x6e4d138 "select idPath from path where strPath='videodb://2/2/85/'") at mysqldataset.cpp:309
#11 0x0000000000823d9f in dbiplus::MysqlDataset::query (this=0x6f87960, query=0x6e4d138 "select idPath from path where strPath='videodb://2/2/85/'") at mysqldataset.cpp:1405
#12 0x0000000000af5e48 in CVideoDatabase::GetPathId (this=this@entry=0x2892de8, strPath=...) at VideoDatabase.cpp:481
#13 0x0000000000af6e0d in CVideoDatabase::GetScraperForPath (this=this@entry=0x2892de8, strPath=..., settings=..., foundDirectly=@0x7fff7c81483f: false) at VideoDatabase.cpp:6582
#14 0x0000000000af7b21 in CVideoDatabase::GetScraperForPath (this=this@entry=0x2892de8, strPath=..., settings=...) at VideoDatabase.cpp:6564
#15 0x0000000000af7b5b in CVideoDatabase::GetScraperForPath (this=this@entry=0x2892de8, strPath=...) at VideoDatabase.cpp:6558
#16 0x0000000000a57ef9 in CGUIWindowVideoBase::GetDirectory (this=this@entry=0x2892780, strDirectory=..., items=...) at GUIWindowVideoBase.cpp:1863
#17 0x0000000000a667d7 in CGUIWindowVideoNav::GetDirectory (this=0x2892780, strDirectory=..., items=...) at GUIWindowVideoNav.cpp:275
#18 0x0000000000932f97 in CGUIMediaWindow::Update (this=this@entry=0x2892780, strDirectory=..., updateFilterPath=false) at GUIMediaWindow.cpp:777
#19 0x0000000000a58028 in CGUIWindowVideoBase::Update (this=0x2892780, strDirectory=..., updateFilterPath=<optimized out>) at GUIWindowVideoBase.cpp:1825
#20 0x000000000092dd96 in CGUIMediaWindow::Refresh (this=0x2892780, clearCache=false) at GUIMediaWindow.cpp:937
#21 0x0000000000a67dc1 in CGUIWindowVideoNav::OnMessage (this=0x2892780, message=...) at GUIWindowVideoNav.cpp:193
#22 0x0000000000766b55 in CGUIWindowManager::SendMessage (this=this@entry=0x241b7a0, message=...) at GUIWindowManager.cpp:146
#23 0x00000000007671f2 in CGUIWindowManager::DispatchThreadMessages (this=0x241b7a0) at GUIWindowManager.cpp:807
#24 0x00000000009409a3 in CApplication::Process (this=0x2416950) at Application.cpp:5065
#25 0x0000000000992244 in CXBApplicationEx::Run (this=0x2416950) at XBApplicationEx.cpp:108
#26 0x0000000000732dcc in XBMC_Run (renderGUI=true) at xbmc.cpp:69
#27 0x0000000000733c07 in main (argc=5, argv=0x7fff7c815d18) at main.cpp:77

So I guess its just a problem when there are windows (CGUIWindowVideoNav in my case) having active network/mysql connections when the system is going to suspend cause those connections might not be accessible anymore after wake up.
I would like to patch XBMC to fix this. Currently I am planning t send GUI_MSG_WINDOW_DEINIT to all windows in CPowerManager::OnSleep and GUI_MSG_WINDOW_INIT in CPowerManager::OnWake. So all windows will have a chance to close their network connections (or other resources) before the system goes to suspend.
Any thoughts about this? I am not really an XBMC developer and I do not know much about the XBMC internals so any hints are suggestions are welcome!
Thanks!
Reply
#2
I made a patch to fix this issue. I did not use the existing window messages Init/Deinit to deinitalize MySQL but I defined new message: GUI_MSG_PREPARE_SLEEP and GUI_MSG_WAKE to give windows the chance to react on those events gracefully.
Would someone take a look at the patch (http://pastebin.com/Mr9QmTcW) and comment about the approach in general? Is this an okaish way to do it or are there better ways? The patch is based on 12.2 at the moment.
I am testing this on my machine since some days and it is to be working fine so far.
Reply

Logout Mark Read Team Forum Stats Members Help
XBMC lockup after suspend when using MySQL0