Bug 323802

Summary: amarok gives MySQL error on startup, no tracks in collection
Product: amarok Reporter: Jonathan Marten <jjm>
Component: Collections/LocalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: grave CC: earendil002, edward.hades, konrad.zemek, matej, ralf-engels, vonreth
Priority: NOR Keywords: regression, release_blocker
Version: 2.8-git   
Target Milestone: 2.9   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 2.9
Attachments: Add debug flag for mysqle initialization
amarok.err
amarok.err

Description Jonathan Marten 2013-08-20 20:09:38 UTC
When running the latest Amarok from Git sources, a message box is shown on startup:

The amarok database reported the following errors:
GREPME MySQLe query failed! (2000) mysql_embedded: Shutdown complete on init
In most cases you will need to resolve these errors before Amarok will run properly.

The Amarok main window is shown as expected, but there are no tracks shown in the "Local Collection" where previously there were plenty.


Reproducible: Always

Steps to Reproduce:
1.  Start the application.
2.  Observe error message as above.
3.  Observe that configured local collection shows no tracks.
Actual Results:  
No tracks in local collection (even after trying an "Update Collection")


Expected Results:  
Tracks that were previously in local collection should be shown.


Amarok version:  2.7-git v2.5.0-1695-gfe022cb
MySQL version:  Ver 14.14 Distrib 5.1.70, for pc-linux-gnu (i686) using readline 5.1

Using Git bisection, this appears to be a consequence of commit:

    commit 141c1191f8849cfa91e8684edd11ab5b726ef101
    Author: Patrick von Reth <vonreth@kde.org>
    Date:   Fri Aug 16 16:09:00 2013 +0200

    Don't communicate with mysql by env vars and autogenerated files

Reverting this commit, or rolling back to an earlier version, fixes the problem.

Starting Amarok from a blank configuration (after removing $KDEHOME/share/config/amarok* and $KDEHOME/share/apps/amarok) does NOT fix the problem.
Comment 1 Myriam Schweingruber 2013-08-20 21:10:36 UTC
Please upgrade your git checkout, we have since released Amarok 2.8, current git describe is v2.8.0-31-gb796f3f
Comment 2 Jonathan Marten 2013-08-21 07:25:57 UTC
Apologies for the misleading information... my git repo was up-to-date as of yesterday, possibly I had not done a pull of tags for a while so they (but only the tags) were not up-to-date.  Have done that, and the problem still persists with:

tag:  v2.8.0-32-ge78c1b6
last commit:  e78c1b66aad8f0b03fe239031455ca955d5b498c
last commit author:    Yuri Chornoivan <yurchor@ukr.net>
last commit date:      Wed Aug 21 09:58:00 2013 +0300
last commit title:     Fix some issues found by Krazy2
Comment 3 Myriam Schweingruber 2013-08-21 07:58:49 UTC
Thank you for the fast feedback.
Comment 4 Matěj Laitl 2013-08-21 10:27:28 UTC
Thanks for the report and especially bisecting. We might as well revert the commit, but first I'd like to understand the reason. I have
mysql Ver 14.14 Distrib 5.1.70, for pc-linux-gnu (x86_64) using readline 5.1
(same as you except architecture), and I don't have this problem, which is really strange.

Edward, you had the same problem with the commit, right? Do you still have it?
Comment 5 Matěj Laitl 2013-08-21 10:29:43 UTC
Needs to be resolved before Amarok 2.9.
Comment 6 Edward Hades 2013-08-21 10:34:25 UTC
Yes and yes.
Comment 7 Konrad Zemek 2013-08-21 11:54:01 UTC
Created attachment 81834 [details]
Add debug flag for mysqle initialization

Please apply this patch and post the contents of $KDEHOME/share/apps/amarok/mysqle/amarok.err , if any.
Comment 8 Matěj Laitl 2013-08-21 12:01:52 UTC
(In reply to comment #7)
> Created attachment 81834 [details]
> Add debug flag for mysqle initialization
> 
> Please apply this patch and post the contents of
> $KDEHOME/share/apps/amarok/mysqle/amarok.err , if any.

Good work, Konrad. If the file is overwritten on every startup (i.e. doesn't bloat over time), I'd consider this patch a candidate to inclusion in master. Akonadi does it too.
Comment 9 Edward Hades 2013-08-21 12:12:25 UTC
Created attachment 81835 [details]
amarok.err

It doesn't do much, unfortunately.
Comment 10 Matěj Laitl 2013-08-21 12:14:48 UTC
Comment on attachment 81835 [details]
amarok.err

Correct mimerype.
Comment 11 Edward Hades 2013-08-21 12:17:23 UTC
(In reply to comment #8)
> Good work, Konrad. If the file is overwritten on every startup (i.e. doesn't
> bloat over time), I'd consider this patch a candidate to inclusion in
> master. Akonadi does it too.

It basically freopen()s the stdout and stderr to the given file. No point relying on mysql in that, we would be better off doing it ourselves in a controlled fashion.
Comment 12 Matěj Laitl 2013-08-21 12:22:59 UTC
(In reply to comment #11)
> (In reply to comment #8)
> > Good work, Konrad. If the file is overwritten on every startup (i.e. doesn't
> > bloat over time), I'd consider this patch a candidate to inclusion in
> > master. Akonadi does it too.
> 
> It basically freopen()s the stdout and stderr to the given file. No point
> relying on mysql in that, we would be better off doing it ourselves in a
> controlled fashion.

Oh right, I didn't expect the behaviour. I think Akonadi runs the full-fledged mysqld,.
Comment 13 Jonathan Marten 2013-08-21 12:45:59 UTC
Created attachment 81836 [details]
amarok.err

Not very enlightening either, unfortunately.
(The crash at the end is when quitting the application, not sure it is connected).
Comment 14 Matěj Laitl 2013-10-27 10:50:08 UTC
Git commit 00dd8b41143ce08d1f529b439a943fd9bd052341 by Matěj Laitl.
Committed on 27/10/2013 at 10:07.
Pushed by laitl into branch 'master'.

MySqlEmbeddedStorage: fix failure to start embedded server because of wrong options

This was because we were passing --myisam-recover-options and this
options does not exist in MySQL 5.1 (and MariaDB). The *command-line*
option (as opposed to system variable name) to set recovery mode is
tricky:
MySQL <= 5.1: --myisam-recover [1]
MySQL >= 5.5: --myisam-recover-options, should also accept
              --myisam-recover [2]
MariaDB: --myisam-recover [3]

*However*, the *system variable name* has always been named
myisam_recover_options, that's why it worked in Amarok <= 2.8.

No need to backport this because of the above.

Simple fix is to rename the option to --myisam-recover
FIXED-IN: 2.9

[1] https://dev.mysql.com/doc/refman/5.1/en/myisam-start.html
[2] https://dev.mysql.com/doc/refman/5.5/en/myisam-start.html
[3] https://mariadb.com/kb/en/myisam-server-system-variables/

M  +1    -0    ChangeLog
M  +1    -1    src/core-impl/collections/db/sql/mysqlecollection/MySqlEmbeddedStorage.cpp

http://commits.kde.org/amarok/00dd8b41143ce08d1f529b439a943fd9bd052341
Comment 15 earendil02 2015-10-29 17:13:43 UTC
This bug seems to have reappeared.
My amarok worked properly until yesterday, then today after a restart required by an upgrade (unfortunately I didn't notice what was being upgraded) I tried to launch amarok but got the following error message:

The amarok database reported the following errors:
MySQLe something failed! on library initialization failed, return code 1
In most cases you will need to resolve these errors before Amarok will run properly.

Afterwards the "Configure-Amarok" windows automatically opens on the "Database" section, but there's nothing to do there apart from setting up an external db (which does not help at all, btw).
The local collection is gon and a full rescan does nothing.

I tried to purge and reinstall it, delete database and configurations, restart the computer, but nothing works. Each time I start amarok I get the error and can't set up a local collection.

I have installed the following version:
Version 2.8.90
Using KDE 4.14.13

The OS is:
Ubuntu 15.10 (upgraded from 15.04)
Linux (x86_64) release 3.16.0-29-generic

Compiler:
x86_64-linux-gnu-gcc
Comment 16 earendil02 2015-10-29 17:16:15 UTC
This bug seems to have reappeared.
My amarok worked properly until yesterday, then today after a restart required by an upgrade (unfortunately I didn't notice what was being upgraded) I tried to launch amarok but got the following error message:

The amarok database reported the following errors:
MySQLe something failed! on library initialization failed, return code 1
In most cases you will need to resolve these errors before Amarok will run properly.

Afterwards the "Configure-Amarok" windows automatically opens on the "Database" section, but there's nothing to do there apart from setting up an external db (which does not help at all, btw).
The local collection is gon and a full rescan does nothing.

I tried to purge and reinstall it (via apt-get), delete database and configurations, restart the computer, but nothing works. Each time I start amarok I get the error and can't set up a local collection.

I have installed the following version:
Version 2.8.90
Using KDE 4.14.13

The OS is:
Ubuntu 15.10 (upgraded from 15.04)
Linux (x86_64) release 3.16.0-29-generic

Compiler:
x86_64-linux-gnu-gcc
Comment 17 Myriam Schweingruber 2015-10-29 19:11:38 UTC
(In reply to earendil02 from comment #15)
> This bug seems to have reappeared.
> My amarok worked properly until yesterday, then today after a restart
> required by an upgrade (unfortunately I didn't notice what was being
> upgraded) I tried to launch amarok but got the following error message:
> 
> The amarok database reported the following errors:
> MySQLe something failed! on library initialization failed, return code 1
> In most cases you will need to resolve these errors before Amarok will run
> properly.
we need the exact error message, did you somehow interrupt something when you started Amarok 2.9 beta for the first time after the upgrade? That would be a grave error, as our release text states: https://amarok.kde.org/en/node/887

FWIW, please also specify your MySQL version, might be related to bug 354255, depending on the MySQL version you use.
Comment 18 earendil02 2015-10-30 00:44:31 UTC
(In reply to Myriam Schweingruber from comment #17)
> (In reply to earendil02 from comment #15)

> we need the exact error message,
The one reported is the exact error message, copypasted "as is", verbatim
>did you somehow interrupt something when
> you started Amarok 2.9 beta for the first time after the upgrade? That would
> be a grave error, as our release text states:
> https://amarok.kde.org/en/node/887
I don't recall anything like that, and the fact that the error continues showing up after a purge and re-installation seems to validate the hypothesis that it had nothing to do with my issue.
> 
> FWIW, please also specify your MySQL version, might be related to bug
> 354255, depending on the MySQL version you use.
I think you solved my problem involuntarily here, looking for the mysql version I found out that there was no mysql installed!!
Now I have the following version:
mysql  Ver 14.14 Distrib 5.6.27, for debian-linux-gnu (x86_64) using  EditLine wrapper

And everything seems to work.
My best hypothesis is that mysql got removed somehow during the upgrade and this caused the error.
However I recommend a check because the re-installation of amarok should install also mysql or at least warn that it is required, and the error message failed to communicate that mysql itself was missing.
Comment 19 Myriam Schweingruber 2015-10-30 10:25:21 UTC
(In reply to earendil02 from comment #18)
...
> > FWIW, please also specify your MySQL version, might be related to bug
> > 354255, depending on the MySQL version you use.
> I think you solved my problem involuntarily here, looking for the mysql
> version I found out that there was no mysql installed!!
> Now I have the following version:
> mysql  Ver 14.14 Distrib 5.6.27, for debian-linux-gnu (x86_64) using 
> EditLine wrapper
> 
> And everything seems to work.
> My best hypothesis is that mysql got removed somehow during the upgrade and
> this caused the error.
> However I recommend a check because the re-installation of amarok should
> install also mysql or at least warn that it is required, and the error
> message failed to communicate that mysql itself was missing.

Then this would be a packaging error, I notified this to the Kubuntu guys. Amarok should always drag in MySQL by default, and you should get a warning if mysql is removed afterwards, as it should also remove Amarok in that case.