clementine-player / Clementine

:tangerine: Clementine Music Player
https://www.clementine-player.org/
GNU General Public License v3.0
3.77k stars 677 forks source link

Library unresponsive after setting a star rating #4950

Open sashkello opened 9 years ago

sashkello commented 9 years ago

I've got Clementine 1.2.3-1213-g7bac8cb installed at the moment, however this issue was present in both stable and other builds I had through time.

Basically, at some seemingly random moments Clementine seem to stop receiving any response from the library. The ratings I set are not saved, if I right-click "Edit track information", it shows the frame which loads forever. Full library rescan gets stuck on one same number as well.

To see what's going on I have launched it from terminal and here's what it prints right before this happens:

12:40:06.457 DEBUG TagReader:794 Saving song rating tags to "/media/sasha/mydisc/Music/Despraorehn.mp3" 12:40:06.458 DEBUG TagReader:862 Setting FMPSFrame: "FMPS_Rating" , "0.5" 12:40:06.765 DEBUG MessageReply:90 Releasing ID 8 (finished) 12:40:06.765 WARN unknown QWaitCondition::wakeAll(): mutex lock failure: Invalid argument

johnsockr commented 8 years ago

I've been experiencing this issue frequently as well when I am rating songs. I built from source (1.2.3-1475-g26d82c2) and I'm running on both FC20 and Linux Mint 17.3.

I debugged this a little and I believe the problem is a race condition where sometimes a MessageReply is deleted before it calls semaphore_.release(). When this happens the behavior is undefined. It looks like maybe futex calls are made on invalid instances inside Qt and this just hangs forever. It often seg faults when I run with a debug build. The reason this happens is:

Just as a test I moved the "emit Finished()" after the semaphore_.release() in both MessageReply::SetReply() and _MessageReplyBase::Abort(). With these changes I haven't experienced a crash or hang yet. This change was more for testing my hypothesis. I have no sense of the broader implications of a subtle change like this to what looks like a core library so I'll leave a proper fix up to somebody who knows all of this code better than I do. I just thought this might be useful information.

sashkello commented 8 years ago

Thanks for that! I have compiled the latest build from source with the changes you suggested, and it works fine for now (2 days of several hours listening). Haven't noticed any issues.

uniquePWD commented 8 years ago

Did either of you ( @johnsockr or @sashkello ) experience the problems described in #3064 ?

It seems like this could be the fix for the long term issues faced there.

johnsockr commented 8 years ago

The symptoms described in #3064 sound similar to what I was experiencing. It certainly could be the same problem. I ended up fixing it in my fork a little differently than I described earlier. See https://github.com/johnsockr/Clementine/commit/fcb11c30959e71fb983c02c3738e070453423e69. I haven't had any hangs since I applied that patch.

calltheninja commented 8 years ago

I found a fix for this after googling for a while and not finding this suggestion. My suspicion was that Clementine was choking on some file it couldn't access or do something important with. I tried disabling "update library" etc. This is on Ubuntu 14.04 x64 with Clementine 1.3.1. Here's the fix that worked for me:

  1. Fix permissions on all local music files I just did the command below to make sure any user/program on the system could access the files: sudo chmod -R 777 /directory/to/music
  2. Fix weird filenames, UTF-8 characters, etc Install the package "detox" from the Ubuntu repos or download it from the link below: https://sourceforge.net/projects/detox/files/detox/ Run the command: detox -r /path/to/music You can add a -n to see what it would change (dry run).
  3. Restart clementine Kill clementine completely and open it again.

This got it working for me, hopefully it works for you!