Bug 231166 - [PATCH]Amarok 2.3.0 incompatible with MySQL 5.5
Summary: [PATCH]Amarok 2.3.0 incompatible with MySQL 5.5
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Collections/Local (show other bugs)
Version: 2.3.0
Platform: Compiled Sources All
: NOR crash
Target Milestone: 2.3.1
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-17 23:22 UTC by Bartosz Fabianowski
Modified: 2011-03-07 11:24 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.3.1


Attachments
Patch to fix Amarok 2.3.0 with MySQL 5.5. (1.72 KB, patch)
2010-03-31 04:39 UTC, Bartosz Fabianowski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bartosz Fabianowski 2010-03-17 23:22:05 UTC
Application: amarok (2.3.0)
KDE Platform Version: 4.4.1 (KDE 4.4.1) (Compiled from sources)
Qt Version: 4.6.1
Operating System: FreeBSD 8.0-STABLE amd64
Distribution (Platform): FreeBSD Ports

-- Information about the crash:
I am trying to run Amarok 2.3.0, built from source (FreeBSD ports) on FreeBSD 7, x64. I am using Qt 4.6.1, KDE 4.4.1 and MySQL 5.5.2, all also compiled from source.

Upon start, Amarok reliably crashes with the backtrace attached to this report. Before Amarok 2.3.0 came out, I tried the release candidate which crashed in the same way.

This is a brand new KDE installation without any stale Amarok configuration files. Just for good measure, I did try removing any amarok* files and directories from within ~/.kde4. It made no difference.

 -- Backtrace:
Application: Amarok (amarok), signal: Segmentation fault: 11
[Switching to Thread 81520aac0 (LWP 100616)]
[Current thread is 1 (Thread 81520aac0 (LWP 100616))]

Thread 7 (Thread 80c4041c0 (LWP 100569)):
[KCrash Handler]
#6  0x0000000803523208 in pthread_mutexattr_init () from /lib/libthr.so.3
#7  0x0000000815ac1e4a in my_thread_init () from /usr/local/kde4/lib/kde4/amarok_collection-mysqlecollection.so
#8  0x0000000815a85578 in mysql_thread_init () from /usr/local/kde4/lib/kde4/amarok_collection-mysqlecollection.so
#9  0x0000000815a746ef in MySqlStorage::initThreadInitializer (this=) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/collection/sqlcollection/mysql-shared/MySqlStorage.cpp:47
#10 0x0000000815a76583 in MySqlStorage::query (this=0x814db6850, statement=@0x7fffffffaec0)
    at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/collection/sqlcollection/mysql-shared/MySqlStorage.cpp:112
#11 0x0000000816155b54 in DatabaseUpdater::adminValue (this=0x814d74ec0, key=) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/collection/sqlcollection/DatabaseUpdater.cpp:1087
#12 0x0000000816155d5b in DatabaseUpdater::needsUpdate (this=0x814d74ec0) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/collection/sqlcollection/DatabaseUpdater.cpp:64
#13 0x00000008161a9dad in SqlCollection::init (this=0x8155bfa80) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/collection/sqlcollection/SqlCollection.cpp:83
#14 0x00000008161ab88e in SqlCollectionFactory::createSqlCollection (this=) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/collection/sqlcollection/SqlCollectionFactory.cpp:133
#15 0x0000000815a794f9 in MySqlEmbeddedCollectionFactory::init (this=0x81551cb30)
    at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/collection/sqlcollection/mysqlecollection/MySqlEmbeddedCollection.cpp:33
#16 0x00000008010d0a57 in CollectionManager::init (this=0x80c714d40) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/collection/CollectionManager.cpp:196
#17 0x00000008010d2cd6 in CollectionManager (this=0x80c714d40) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/collection/CollectionManager.cpp:117
#18 0x00000008010d2dc6 in CollectionManager::instance () at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/collection/CollectionManager.cpp:94
#19 0x00000008010096c7 in ServiceFactory (this=0x8155bcc00) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/services/ServiceBase.cpp:39
#20 0x000000081502e753 in create_plugin () at LastFmService.h:51
#21 0x00000008012b3486 in PluginManager::createFromService (service=@0x7fffffffbbd0) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/PluginManager.cpp:111
#22 0x00000008010202c4 in ServicePluginManager::collect (this=0x814dae910) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/services/ServicePluginManager.cpp:65
#23 0x0000000801020a02 in ServicePluginManager (this=0x814dae910) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/services/ServicePluginManager.cpp:42
#24 0x0000000801020a7e in ServicePluginManager::instance () at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/services/ServicePluginManager.cpp:32
#25 0x0000000800e829d6 in Model (this=0x8154fffc0, parent=) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/playlist/PlaylistModel.cpp:67
#26 0x0000000800e8982b in ModelStack (this=0x8154dff40) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/playlist/PlaylistModelStack.cpp:63
#27 0x0000000800e899a7 in Playlist::ModelStack::instance () at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/playlist/PlaylistModelStack.cpp:46
#28 0x0000000800e899e3 in The::playlist () at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/playlist/PlaylistModelStack.cpp:28
#29 0x00000008011e30b1 in StatusBar (this=0x814db8100, parent=) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/statusbar/StatusBar.cpp:89
#30 0x00000008012a4992 in MainWindow (this=0x81467bf80) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/MainWindow.cpp:158
#31 0x0000000801267f6c in App::continueInit (this=0x7fffffffc730) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/App.cpp:664
#32 0x0000000801269a5d in App (this=0x7fffffffc730) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/App.cpp:211
#33 0x0000000000407863 in main (argc=1, argv=0x7fffffffe600) at /usr/ports/audio/amarok-kde4/work/amarok-2.3.0/src/main.cpp:235

Thread 6 (Thread 80c7a98c0 (LWP 100608)):
#0  0x0000000803527f2c in __error () from /lib/libthr.so.3
#1  0x00000008035263e1 in pthread_cond_signal () from /lib/libthr.so.3
#2  0x000000081020dddb in metronom_sync_loop () from /usr/local/lib/libxine.so
#3  0x000000080351f2e1 in pthread_getprio () from /lib/libthr.so.3
#4  0x0000000000000000 in ?? ()

Thread 5 (Thread 80c7a9700 (LWP 100612)):
#0  0x00000008036f511c in clock_gettime () from /lib/libc.so.7
#1  0x0000000802142619 in qt_gettime () from /usr/local/lib/qt4/libQtCore.so.4
#2  0x0000000802146b21 in QTimerInfoList::updateCurrentTime () from /usr/local/lib/qt4/libQtCore.so.4
#3  0x00000008021470cd in QTimerInfoList::timerWait () from /usr/local/lib/qt4/libQtCore.so.4
#4  0x00000008021455c9 in timerSourcePrepareHelper () from /usr/local/lib/qt4/libQtCore.so.4
#5  0x000000080941a3b9 in g_main_context_prepare () from /usr/local/lib/libglib-2.0.so.0
#6  0x000000080941aafd in g_main_context_check () from /usr/local/lib/libglib-2.0.so.0
#7  0x000000080941b275 in g_main_context_iteration () from /usr/local/lib/libglib-2.0.so.0
#8  0x00000008021459a4 in QEventDispatcherGlib::processEvents () from /usr/local/lib/qt4/libQtCore.so.4
#9  0x000000080211c5bb in QEventLoop::processEvents () from /usr/local/lib/qt4/libQtCore.so.4
#10 0x000000080211c895 in QEventLoop::exec () from /usr/local/lib/qt4/libQtCore.so.4
#11 0x000000080202d87b in QThread::exec () from /usr/local/lib/qt4/libQtCore.so.4
#12 0x0000000810087c98 in Phonon::Xine::XineThread::run () from /usr/local/kde4/lib/kde4/plugins/phonon_backend/phonon_xine.so
#13 0x0000000802030793 in QThreadPrivate::start () from /usr/local/lib/qt4/libQtCore.so.4
#14 0x000000080351f2e1 in pthread_getprio () from /lib/libthr.so.3
#15 0x0000000000000000 in ?? ()

Thread 4 (Thread 80c7a91c0 (LWP 100613)):
#0  0x0000000803527f2c in __error () from /lib/libthr.so.3
#1  0x00000008035263e1 in pthread_cond_signal () from /lib/libthr.so.3
#2  0x000000081021a632 in fifo_peek_int () from /usr/local/lib/libxine.so
#3  0x000000081021b313 in ao_loop () from /usr/local/lib/libxine.so
#4  0x000000080351f2e1 in pthread_getprio () from /lib/libthr.so.3
#5  0x0000000000000000 in ?? ()

Thread 3 (Thread 80c40ae40 (LWP 100614)):
#0  0x0000000803527f2c in __error () from /lib/libthr.so.3
#1  0x00000008035263e1 in pthread_cond_signal () from /lib/libthr.so.3
#2  0x000000081021a632 in fifo_peek_int () from /usr/local/lib/libxine.so
#3  0x000000081021b313 in ao_loop () from /usr/local/lib/libxine.so
#4  0x000000080351f2e1 in pthread_getprio () from /lib/libthr.so.3
#5  0x0000000000000000 in ?? ()

Thread 2 (Thread 81520ac80 (LWP 100615)):
#0  0x0000000803527f2c in __error () from /lib/libthr.so.3
#1  0x00000008035263e1 in pthread_cond_signal () from /lib/libthr.so.3
#2  0x000000081021a632 in fifo_peek_int () from /usr/local/lib/libxine.so
#3  0x000000081021b313 in ao_loop () from /usr/local/lib/libxine.so
#4  0x000000080351f2e1 in pthread_getprio () from /lib/libthr.so.3
#5  0x0000000000000000 in ?? ()

Thread 1 (Thread 81520aac0 (LWP 100616)):
#0  0x0000000803527f2c in __error () from /lib/libthr.so.3
#1  0x00000008035263e1 in pthread_cond_signal () from /lib/libthr.so.3
#2  0x000000081021a632 in fifo_peek_int () from /usr/local/lib/libxine.so
#3  0x000000081021b313 in ao_loop () from /usr/local/lib/libxine.so
#4  0x000000080351f2e1 in pthread_getprio () from /lib/libthr.so.3
#5  0x0000000000000000 in ?? ()

Reported using DrKonqi
Comment 1 Bartosz Fabianowski 2010-03-17 23:31:25 UTC
Not that it is likely to make much difference but the system I am using is actually FreeBSD 8, not 7.
Comment 2 Mikko C. 2010-03-18 08:11:37 UTC
Seems like a crash in Mysql:

[KCrash Handler]
#6  0x0000000803523208 in pthread_mutexattr_init () from /lib/libthr.so.3
#7  0x0000000815ac1e4a in my_thread_init () from
/usr/local/kde4/lib/kde4/amarok_collection-mysqlecollection.so
#8  0x0000000815a85578 in mysql_thread_init () from
/usr/local/kde4/lib/kde4/amarok_collection-mysqlecollection.so

Maybe 5.5.2 is too recent... Or maybe it's Bsd... Jeff?
Comment 3 Jeff Mitchell 2010-03-18 14:18:26 UTC
It does seem to be a crash in mysql.

I know of no other distribution using mysql 5.5, which I take to mean "nobody thinks it's stable" and "it's not well tested" :-)

Please try downgrading mysql, rebuilding Amarok, and seeing if that fixes things.
Comment 4 Bartosz Fabianowski 2010-03-31 04:39:24 UTC
Created attachment 42393 [details]
Patch to fix Amarok 2.3.0 with MySQL 5.5.
Comment 5 Bartosz Fabianowski 2010-03-31 04:43:54 UTC
I have added some debug code and identified the problem. The issue is in line 78 of MySqlEmbeddedStorage.cpp. Here, the "default-table-type" variable is set to MYISAM. This variable has been synonymous with "default-storage-engine" (set in line 79 of the same file) since MySQL 5.0 and also has been deprecated since then. In MySQL 5.5, the variable was finally removed. Hence, the embedded MySQL server fails to start up and it all goes downhill from there.

The attached patch removes the line that set "default-table-type" to MYISAM, fixing Amarok with MySQL 5.5. Users of MySQL 5.0 will see no change as setting both "default-table-type" and "default-storage-engine" was redundant anyway.
Comment 6 Sven Krohlas 2010-03-31 12:05:36 UTC
As MySQL 5.5 will become more and more popular: nominating as release blocker.

@reporter: it would be great if you could create a merge request of this at http://gitorious.org/amarok/amarok/merge_requests
Comment 7 Jeff Mitchell 2010-03-31 13:25:55 UTC
No, please, do not create a merge request. I don't even need the patch, just the description is plenty.  :-)

Fixed in git.
Comment 8 Jeff Mitchell 2010-03-31 13:26:11 UTC
commit cebd6875f9fa614ceeb5428236737f3f9f354833
Author: Jeff Mitchell <mitchell@kde.org>
Date:   Wed Mar 31 07:25:30 2010 -0400

    Fix crash on startup with MySQL 5.5. Thanks to Bartosz Fabianowski for figuring out the cause.
    
    BUG: 231166

diff --git a/ChangeLog b/ChangeLog
index 5f761a9..bba787d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -51,6 +51,8 @@ VERSION 2.3.1-Beta 1
        some MySQL versions. (BR 225052)
 
   BUGFIXES:
+     * Fixed crash on startup for users of MySQL 5.5. Thanks to Bartosz Fabianowski
+       for figuring it out. (BR 231166)
      * Readded missing hover info for the new filebrowser.
      * Fixed missing images in the hover info shown for various browser categories.
      * Fixed crash when running some Amarok urls on startup. (such as when passed on
diff --git a/src/core-implementations/collections/sqlcollection/mysqlecollection/MySqlEmbeddedStorage.cpp b/src/core-implementations/collections/sqlcollection/mysqlecollection/MySqlEmbeddedStorage.cpp
index 902ef6c..2a03002 100644
--- a/src/core-implementations/collections/sqlcollection/mysqlecollection/MySqlEmbeddedStorage.cpp
+++ b/src/core-implementations/collections/sqlcollection/mysqlecollection/MySqlEmbeddedStorage.cpp
@@ -68,20 +68,19 @@ MySqlEmbeddedStorage::MySqlEmbeddedStorage( const QString &storageLocation )
         dir.mkpath( "." );
     }
 
-    static const int num_elements = 10;
+    static const int num_elements = 9;
     char **server_options = new char* [ num_elements + 1 ];
     server_options[0] = const_cast<char*>( "amarokmysqld" );
     server_options[1] = defaultsLine;
     server_options[2] = databaseLine;
     // CAUTION: if we ever change the table type we will need to fix a number of MYISAM specific
     // functions, such as FULLTEXT indexing.
-    server_options[3] = const_cast<char*>( "--default-table-type=MYISAM" );
-    server_options[4] = const_cast<char*>( "--default-storage-engine=MYISAM" );
-    server_options[5] = const_cast<char*>( "--loose-skip-innodb" );
-    server_options[6] = const_cast<char*>( "--skip-grant-tables" );
-    server_options[7] = const_cast<char*>( "--myisam-recover=FORCE" );
-    server_options[8] = const_cast<char*>( "--character-set-server=utf8" );
-    server_options[9] = const_cast<char*>( "--collation-server=utf8_bin" );
+    server_options[3] = const_cast<char*>( "--default-storage-engine=MYISAM" );
+    server_options[4] = const_cast<char*>( "--loose-skip-innodb" );
+    server_options[5] = const_cast<char*>( "--skip-grant-tables" );
+    server_options[6] = const_cast<char*>( "--myisam-recover=FORCE" );
+    server_options[7] = const_cast<char*>( "--character-set-server=utf8" );
+    server_options[8] = const_cast<char*>( "--collation-server=utf8_bin" );
     server_options[num_elements] = 0;
 
     char **server_groups = new char* [ 3 ];
Comment 9 Myriam Schweingruber 2011-03-07 11:24:21 UTC
*** Bug 267409 has been marked as a duplicate of this bug. ***