Bug 349731

Summary: Freeze while scanning library for updates.
Product: [Applications] amarok Reporter: ghost53947
Component: Collections/LocalAssignee: Amarok Bugs <amarok-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: matej, ralf-engels
Priority: NOR    
Version First Reported In: 2.8-git   
Target Milestone: 2.9   
Platform: Compiled Sources   
OS: Linux   
URL: http://sprunge.us/MGaH
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: output from link
Terminal1 trace.
Terminal2 trace
lines before and after the freeze happens
Ui freezing on update library

Description ghost53947 2015-06-30 00:04:52 UTC
When running amarok and going to settings -> configure amarok and just closing the window (ok or cancel button) amarok will start to scan the library for any changes, while this happens the UI freezes up and will not respond. Neither will the system tray responder either. Once this has complete and a window showing the duplicates it did not import is shown and the UI return to responding normally. If this is done a second time from starting amarok after quitting it the page showing the duplicates it did not import will not show but it will still have the same behavior till the scan is done. 

Reproducible: Always

Steps to Reproduce:
1. Open amarok
2. Go to settings -> configure amarok
3. press cancel and let amarok do the its scan of the library to see what files have changes or has been added. 

Actual Results:  
UI freezes until this process is done completely. 

Expected Results:  
UI should not freeze 

I had this error on both KDE 4 and Plasma 5 (latest version of both). Running on Arch linux, with 16 gb ram, intel i7 5960k. I have a hard drive dedicated to Music only and it is an internal Sata drive. I have full read write permissions to the drive.
Comment 1 Myriam Schweingruber 2015-06-30 01:18:48 UTC
Created attachment 93425 [details]
output from link

This is the output of the mentioned link.

Please always attach outputs directly to the bugs database rather than link to external sources.
Comment 2 Matěj Laitl 2015-07-06 12:40:09 UTC
Hi ghost,
we would need a stack trace of all threads from the point in time where UI was frozen. Please follow this how-to: https://community.kde.org/Amarok/Development/DebuggingHowTo#Debugging_Hangs

Thanks.
Comment 3 ghost53947 2015-07-12 09:26:48 UTC
Created attachment 93573 [details]
Terminal1 trace.

As described in the gdb trace, this is the trace of terminal 1 executing amarok.
Comment 4 ghost53947 2015-07-12 09:28:24 UTC
Created attachment 93574 [details]
Terminal2 trace

Trace from Terminal2 using gdb at the point where the UI freezes up. I would like to note that when amarok outputs no space left on device, that there is actually about 400Gb of free space that it can write to. Importing a new track to the library works and does not give this error.
Comment 5 Matěj Laitl 2015-07-15 09:07:05 UTC
(In reply to ghost53947 from comment #4)
> Created attachment 93574 [details]
> Terminal2 trace
> 
> Trace from Terminal2 using gdb at the point where the UI freezes up. I would
> like to note that when amarok outputs no space left on device, that there is
> actually about 400Gb of free space that it can write to. Importing a new
> track to the library works and does not give this error.

Hi ghost, the backtrace is unfortunately only paritally usable as it lacks symbols for some critical libraries (threadweaver of kdelibs, Qt, libc). It also shows that the main thread was inside /usr/lib/libnvidia-glcore.so.352.21 library, which I think is a proprietary nvidia driver.

To proceed, we would need:
 a) better backtrace, https://community.kde.org/Amarok/Development/DebuggingHowTo mentions how
 b) is this reproducible also with open-source nvidia drivers?
Comment 6 ghost53947 2015-07-20 20:52:09 UTC
The libnvidia-glcore might be due to running in opengl3 mode. I ran amarok in cinnamon same issue, but no mention of the nvidia. I will have to rebuild the kdelibs, Qt, and libc to include debugging symbols. Are there any other components that need to be rebuilt?
Comment 7 ghost53947 2015-08-27 19:40:32 UTC
I believe I found one of the biggest culprits, Some of the folders had non utf-8 characters in them. I think this was causing problems when the scanning was happening.
Comment 8 ghost53947 2015-08-27 19:41:52 UTC
Characters that display as "��r" in a linux terminal and file manager.
Comment 9 ghost53947 2015-09-03 22:04:42 UTC
After finding that there were non UTF-8 characters in my folder names I remove all of those characters and then copied the music to an external drive and deleted the collection folder. After that I used Clementine ( because amarok took too long to discover the music ) to import the backup to a new collection folder again. I am getting the same error that there is no space left on the device. However when it happened the UI did not freeze as it did last time. Amarok keeps doing this process [AbstractDirectoryWatcher] addDirToList for "/mnt/MUSIC/Music/zzzzz/Music" . 

The UI  seems to freeze for a while when I see this output in the terminal: amarok: BEGIN: virtual void SqlScanResultProcessor::scanSucceeded() 
amarok:   BEGIN: virtual void AbstractScanResultProcessor::scanSucceeded() 
Media controls do not work either at this stage. 

Collection folder rights. drwxr-xr-x 1 frosted users  3108864 Aug 29 18:32 Music
Comment 10 ghost53947 2015-09-03 22:05:20 UTC
Created attachment 94388 [details]
lines before and after the freeze happens
Comment 11 ghost53947 2015-09-03 22:15:13 UTC
amarokcollectionscanner takes on the longest 1s to execute.

 In the console output I see the process "amarok: [AbstractDirectoryWatcher] addDirToList for" being run 2 or 3 times before the freeze occurs. As well as :
"QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: No space left on device
QFileSystemWatcher: failed to add paths: /mnt/MUSIC/Music/{some folder}" being printed out.
Comment 12 Myriam Schweingruber 2016-02-10 18:56:01 UTC
Still waiting for a useful backtrace (see comment #5)
Comment 13 ghost53947 2016-02-20 21:08:17 UTC
Amarok is a lot more stable since the last time I built. No problem while running it. 
Doing a "tools" update collection, causes the UI to hang still. 
Last times I saw before the hang and I had to force a SIGINT on amarok was 
"amarok: BEGIN: virtual void SqlScanResultProcessor::scanSucceeded() 
amarok:   BEGIN: virtual void AbstractScanResultProcessor::scanSucceeded() 
[Thread 0x7ffebbfff700 (LWP 6905) exited]
"
I have added the gdb.txt output
Comment 14 ghost53947 2016-02-20 21:08:54 UTC
Created attachment 97318 [details]
Ui freezing on update library
Comment 15 ghost53947 2016-02-20 21:14:04 UTC
(In reply to ghost53947 from comment #13)
> Amarok is a lot more stable since the last time I built. No problem while
> running it. 
> Doing a "tools" update collection, causes the UI to hang still. 
> Last times I saw before the hang and I had to force a SIGINT on amarok was 
> "amarok: BEGIN: virtual void SqlScanResultProcessor::scanSucceeded() 
> amarok:   BEGIN: virtual void AbstractScanResultProcessor::scanSucceeded() 
> [Thread 0x7ffebbfff700 (LWP 6905) exited]
> "
> I have added the gdb.txt output

I have installed Qt5 with debugging, used pyqt5-common-debug python-pyqt5-debug qt5-base-debug qt5-webkit-debug , from https://github.com/The-Compiler/qutebrowser/blob/master/doc/stacktrace.asciidoc#archlinux
Comment 16 Myriam Schweingruber 2016-02-21 09:20:41 UTC
(In reply to ghost53947 from comment #15)
> (In reply to ghost53947 from comment #13)
> > Amarok is a lot more stable since the last time I built. No problem while
> > running it. 
> > Doing a "tools" update collection, causes the UI to hang still. 
> > Last times I saw before the hang and I had to force a SIGINT on amarok was 
> > "amarok: BEGIN: virtual void SqlScanResultProcessor::scanSucceeded() 
> > amarok:   BEGIN: virtual void AbstractScanResultProcessor::scanSucceeded() 
> > [Thread 0x7ffebbfff700 (LWP 6905) exited]
> > "
> > I have added the gdb.txt output
> 
> I have installed Qt5 with debugging, used pyqt5-common-debug
> python-pyqt5-debug qt5-base-debug qt5-webkit-debug , from
> https://github.com/The-Compiler/qutebrowser/blob/master/doc/stacktrace.
> asciidoc#archlinux

You do realize that Amarok 2.8-master still depends on Qt4, don't you?
Comment 17 Myriam Schweingruber 2016-02-21 09:25:21 UTC
(In reply to ghost53947 from comment #14)
> Created attachment 97318 [details]
> Ui freezing on update library

the excerpt of the backtrace you posted shows a problem with libmysqld, and still lacks lign numbers
Comment 18 Myriam Schweingruber 2017-02-13 18:34:50 UTC
Closing for lack of feedback. Please feel free to reopen this bug if you can still reproduce this problem, taking into account the comments #16 and 17,though.