Application not responding

Bug #1214103 reported by netmask
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SubDownloader
Triaged
Undecided
Unassigned

Bug Description

The application takes too long to open. When I click the icon I see an empty window for a looong time, then I get the Gnome window saying the application is not responding, asking if I want to force close or wait. I click wait, then after a while it comes up again, and the process repeats for a few times. After 4-5x I finally see the directory listing.

My movies are in a 3rd level directory under an NFS mounted directory: /mnt/nas is the mounted directory, and /mnt/nas/Video is where the video files are.

I tried running "strace" on the while the app was starting, and I notice it was scanning ALL files under the root NFS directory (/mnt/nas), which I THINK is causing the delay, because there is a huge amount of non-video files (docs, MP3, etc).

If you need any more information, just let me know how to provide it. Apparently debug mode is not very helpful (notice the 7 minutes delay between "current directory" and "creating server".

$ cat /etc/fedora-release
Fedora release 19 (Schrödinger’s Cat)
$ rpm -q python
python-2.7.5-3.fc19.x86_64
$ rpm -q subdownloader
subdownloader-2.0.18-2.fc19.noarch
[mteixeir@netmask ~]$ sudo mount /mnt/pch
[mteixeir@netmask ~]$ time subdownloader -d
[16:15] DEBUG::subdownloader.gui.main # Building main dialog
[16:15] DEBUG::subdownloader.gui.main # Showing main dialog
[16:15] DEBUG::subdownloader.gui.main # Scanning translation files .mo in folder: /usr/share/locale/
[16:15] DEBUG::subdownloader.gui.main # Found these translations languages: ['vi', 'es_ES', 'id', 'et', 'de', 'mk', 'sk', 'fr', 'hu', 'ro', 'he', 'da', 'en', 'sv', 'tr', 'fi', 'nl', 'pt_PT', 'hr', 'it', 'zh_TW', 'pt_BR', 'sr', 'ko', 'sq', 'ja', 'gl', 'eu', 'pl', 'cs', 'el', 'bg', 'ru']
[16:15] DEBUG::subdownloader.gui.main # Interface language: en
[16:15] DEBUG::subdownloader.gui.main # Current directory: /mnt/nas/Video/Movies
[16:22] DEBUG::subdownloader.SDService.SDService # Creating Server with server = None and proxy = None
[16:22] DEBUG::subdownloader.SDService.SDService # Creating XMLRPC server connection... to server http://api.opensubtitles.org/xml-rpc with proxy None
[16:22] DEBUG::subdownloader.SDService.SDService # Connecting with parameters ('http://api.opensubtitles.org/xml-rpc', None)
[16:22] DEBUG::subdownloader.WebService # successfully tested connection
[16:22] DEBUG::subdownloader.SDService.SDService # Trying direct connection...
[16:22] DEBUG::subdownloader.SDService.SDService # ...connected
[16:22] DEBUG::subdownloader.SDService.SDService # connection connected <modules.SDService.TimeoutFunction instance at 0x7fb6b3ae55f0>
[16:22] DEBUG::subdownloader.SDService.SDService # Creating Server with server = None and proxy = None
[16:22] DEBUG::subdownloader.SDService.SDService # Creating XMLRPC server connection... to server http://sddb.subdownloader.net/xmlrpc/ with proxy None
[16:22] DEBUG::subdownloader.SDService.SDService # Connecting with parameters ('http://sddb.subdownloader.net/xmlrpc/', None)
[16:22] DEBUG::subdownloader.WebService # successfully tested connection
[16:22] DEBUG::subdownloader.SDService.SDService # Trying direct connection...
[16:22] DEBUG::subdownloader.SDService.SDService # ...connected
[16:22] DEBUG::subdownloader.SDService.SDService # connection connected <modules.SDService.TimeoutFunction instance at 0x7fb6b3aebb90>

(python:4347): Gtk-CRITICAL **: IA__gtk_progress_configure: assertion `value >= min && value <= max' failed

(python:4347): Gtk-CRITICAL **: IA__gtk_progress_configure: assertion `value >= min && value <= max' failed

(python:4347): Gtk-CRITICAL **: IA__gtk_progress_configure: assertion `value >= min && value <= max' failed

(python:4347): Gtk-CRITICAL **: IA__gtk_progress_configure: assertion `value >= min && value <= max' failed

(python:4347): Gtk-CRITICAL **: IA__gtk_progress_configure: assertion `value >= min && value <= max' failed
[16:22] DEBUG::subdownloader.SDService.SDService # ----------------
[16:22] DEBUG::subdownloader.SDService.SDService # Logging in (username: )...
[16:22] DEBUG::subdownloader.SDService.SDService # Login ended in 0.006 with status: 200 OK
[16:22] DEBUG::subdownloader.SDService.SDService # Session ID: <hidden>
[16:22] DEBUG::subdownloader.SDService.SDService # ----------------

Revision history for this message
Kapis (capiscuas) wrote :

Can you try the commandline version of the software to see what it could be?

try the -h option to get the parameters help.

Also you could try to delete the $HOME/.config/SubDownloader/SubDownloader.conf file and restart the application, and let us know.

Revision history for this message
netmask (netmask) wrote :
Download full text (35.0 KiB)

CLI version is way faster, specially because it seems it doesn't scan anything outside of the video directory...

$ subdownloader -c -V /mnt/nas/Video/Movies
[16:55] INFO::subdownloader.cli.main # Scanning /mnt/nas/Video/Movies ...
[16:55] INFO::metadata # unhandled base atom iods
[16:55] INFO::metadata # parsing mdat
[16:55] INFO::metadata # end of mdat
[16:55] INFO::metadata # unhandled base atom iods
[16:55] INFO::metadata # parsing mdat
[16:55] INFO::metadata # end of mdat
[16:55] INFO::metadata # No Type found by Extension (.mkv). Trying all parsers.
[16:55] ERROR::metadata # parser error
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/kaa/metadata/factory.py", line 195, in create_from_file
    return self.get_class(e[R_CLASS])(file)
  File "/usr/lib64/python2.7/site-packages/kaa/metadata/audio/m4a.py", line 175, in __init__
    tags = M4ATags(file)
  File "/usr/lib64/python2.7/site-packages/kaa/metadata/audio/m4a.py", line 146, in __init__
    self.atom2tag(atomtype, atomdata)
  File "/usr/lib64/python2.7/site-packages/kaa/metadata/audio/m4a.py", line 156, in atom2tag
    timescale= struct.unpack("!Q",atomdata[20:24])[0]
error: unpack requires a string argument of length 8
[16:55] INFO::metadata # Invalid header
[16:55] INFO::metadata # unhandled base atom iods
[16:55] ERROR::metadata # parser error
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/kaa/metadata/factory.py", line 195, in create_from_file
    return self.get_class(e[R_CLASS])(file)
  File "/usr/lib64/python2.7/site-packages/kaa/metadata/video/mp4.py", line 218, in __init__
    while self._readatom(file):
  File "/usr/lib64/python2.7/site-packages/kaa/metadata/video/mp4.py", line 421, in _readatom
    while self._readatom(file):
  File "/usr/lib64/python2.7/site-packages/kaa/metadata/video/mp4.py", line 303, in _readatom
    trackinfo['length'] = mdhd[4] / mdhd[3]
ZeroDivisionError: integer division or modulo by zero
[16:55] INFO::metadata # trying mpeg-pes scan
[16:55] INFO::metadata # unhandled base atom iods
[16:55] ERROR::metadata # parse error
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/kaa/metadata/factory.py", line 154, in create_from_file
    return parser(file)
  File "/usr/lib64/python2.7/site-packages/kaa/metadata/video/mp4.py", line 218, in __init__
    while self._readatom(file):
  File "/usr/lib64/python2.7/site-packages/kaa/metadata/video/mp4.py", line 421, in _readatom
    while self._readatom(file):
  File "/usr/lib64/python2.7/site-packages/kaa/metadata/video/mp4.py", line 303, in _readatom
    trackinfo['length'] = mdhd[4] / mdhd[3]
ZeroDivisionError: integer division or modulo by zero
[16:55] INFO::metadata # trying mpeg-pes scan
[16:55] INFO::metadata # No Type found by Extension (.mp4). Trying all parsers.
[16:55] ERROR::metadata # parser error
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/kaa/metadata/factory.py", line 195, in create_from_file
    return self.get_class(e[R_CLASS])(file)
  File "/usr/lib64/python2.7/site-packages/kaa/metadata/audio/m4a.py", line 175, in __init__
    tags = M4ATags(file)
  File "/usr/lib64/python2...

Revision history for this message
netmask (netmask) wrote :

Just to make it clear, watching strace on the CLI run doesn't seem like it scans anything outside the actual directory I asked for.

Revision history for this message
netmask (netmask) wrote :

Running the application without the config file makes it open instantly.

Revision history for this message
netmask (netmask) wrote :

Sorry, I hit post too quick on the previous comment.

Running the application without the config file makes the GUI version open instantly.

However when click on the + signs to find the video directory makes it "freeze" a little while expanding. Looking at strace it seems it is scanning the sub directories, however it's still fast.

Once I close, then open again, problem persists.

Revision history for this message
Kapis (capiscuas) wrote :

I'm afraid unless somebody submits a patch for it, the preferences doesn't have yet an option to avoid recursive searching in a folder.

What you could do meanwhile is to just move or create a (symbolic) link to a folder containing the videos you want to find subtitles and click on that folder only.

Or use the open a video button instead of a whole folder and select multiple videofiles.
Let me know if that's a workaround solution.

Revision history for this message
netmask (netmask) wrote :

I can't even use the video button until the app finishes scanning everything.

At least let me know which module file or function I should be looking at, and I'll try a patch.

Revision history for this message
Kapis (capiscuas) wrote :

Your issue is at the config file parameter "workingDirectory" , try to search that string in the code and you'll see where the initial scan is being done and maybe you can disable it or edit that string everytime you want to use the app for the moment.

Sorry I can't be of more help, no time these days to try a patch myself.

Good luck.

Revision history for this message
netmask (netmask) wrote :

Actually the fix was waaaaay easier than I expected...

According to Qt docs, QDirModel is deprecated and you should use QFileSystemModel instead.

The patch below fixes the issue:

=== modified file 'gui/main.py'
--- gui/main.py 2012-11-04 14:45:22 +0000
+++ gui/main.py 2013-08-23 21:06:13 +0000
@@ -94,7 +94,7 @@
         self.splitter.setSizes([600, 1000])

         #SETTING UP FOLDERVIEW
- model = QDirModel(window)
+ model = QFileSystemModel(window)
         model.setFilter(QDir.AllDirs|QDir.NoDotAndDotDot)
         self.folderView.setModel(model)

@@ -127,6 +127,7 @@
         #Loop to expand the current directory in the folderview.
         lastDir = settings.value("mainwindow/workingDirectory", QVariant(QDir.homePath()))
         log.debug('Current directory: %s' % lastDir.toString())
+ model.setRootPath(lastDir.toString())
         path = QDir(lastDir.toString())
         while True:
             self.folderView.expand(model.index(path.absolutePath()))

Revision history for this message
Kapis (capiscuas) wrote :

Way to go, that's why I love opensource and smart people.

This will be committed for the next released.

Thanks.

Changed in subdownloader:
status: New → Triaged
Revision history for this message
netmask (netmask) wrote :

Today I just notice the directories were not sorted. So I patched again.

Since I think I can contribute a little more, I also decided to branch the code.

http://bazaar.launchpad.net/~netmask/subdownloader/subdownloader/revision/557

Revision history for this message
Kapis (capiscuas) wrote :

Very well netmask. That way it will be better for u to have an updated branch, we'll update often too if possible.

keep us posted.

thks

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.