Bug 303173 - Export busy loop [patch]
Summary: Export busy loop [patch]
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-WebService-Piwigo (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-07 23:06 UTC by Wolfgang Breyha
Modified: 2023-02-25 09:22 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 3.0.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Breyha 2012-07-07 23:06:04 UTC
gallery export worked for several versions with my G2 gallery.

After upgrading to 2.6.0 it busyloops and I have to kill digikam. stracing it shows that it successfully requests the list of albums and wents in the busyloop right after. strace shows no output, so it doesn't loop calling libraryfunctions.

I tried to delete plugin config and redefine my gallery... same result.

Reproducible: Always

Steps to Reproduce:
1. configure gallery2
2. list of albums does not appear. only "new album" gets activated. 1 CPU core goes to 100% until digikam gets killed.
3.
Actual Results:  
100% CPU on one core.

Expected Results:  
list of albums
Comment 1 kaufman-kde 2012-07-11 10:38:17 UTC
Same experience: I have been using export to gallery in digikam since before KDE 4. Since upgrading to 2.6.0, it busyloops (apparently) and does not terminate after 5-10 minutes.

I am running digikam 2.6.0, kipip-plugins 2.6.0, gcc 4.5.3 if that matters... what other information would help?
Comment 2 Felix Tiede 2012-08-05 20:52:55 UTC
Can confirm with kipi-plugins 2.7.0 on Gentoo Linux, KDE 4.9.0.

Strace shows an endless loop of EAGAIN errors. Timeout does not occur.
Comment 3 Felix Tiede 2012-08-11 03:38:14 UTC
Problem still exists with didikam-2.8.0/kipi-plugins-2.8.0.
Comment 4 kaufman-kde 2012-09-15 21:50:06 UTC
Problem still exists with digikam-2.9.0/kipi-plugins-2.9.0. Sigh. This may force me to find another photo manager.
Comment 5 Wolfgang Breyha 2012-09-17 22:44:20 UTC
i did some research...

g2 sets ref_num in album.name.x. kipi_plugin currently uses the "x" from album.name.x as ref_num instead. Don't know if that's correct for g3. 

With g2 this causes the mentioned endless loop because some folders cant be linked to their parent folders and their is no countermeasure to check for unlinked folders.

--- gallerytalker.cpp.orig	2012-09-18 00:21:33.581561874 +0200
+++ gallerytalker.cpp	2012-09-18 00:11:53.308646253 +0200
@@ -489,7 +489,10 @@
                 {
                         GAlbum album;
                         album.name    = value;
-                        album.ref_num = key.section('.', 2, 2).toInt();
+                        if (s_using_gallery2)
+                            album.ref_num = value.toInt();
+                        else
+                            album.ref_num = key.section('.', 2, 2).toInt();
                         iter = albumList.insert(iter, album);
                 }
                 else if (key.startsWith(QLatin1String("album.title")))

fixes it at least for g2 on 2.8.0 I'm currently using on F17. I can provide my fixed .so for i686.fc17 on request until this is fixed upstream.
Comment 6 Wolfgang Breyha 2012-09-18 14:03:57 UTC
As far as I can tell this
https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/diff/galleryexport/gallerywindow.cpp?rev=532f58842b40249eb1e13b847f46c5b1e88b76f6&rev_to=e8b2f41f43e4c882143ef1b532b95bffadd6da93
is the patch which broke things. Don't know what the intention was, but at least for g2 it was wrong.
Comment 7 Andrew Goodbody 2012-09-18 20:25:30 UTC
The patch in comment #5 looks OK to me. Although the Gallery Remote protocol documentation does state that the album name is a unique identifier in G2 it does not state that the ref_num from album.name.ref_num will not be valid, but this seems to be the observed behaviour from G2.
Gilles, will you apply the patch?
Comment 8 caulier.gilles 2012-09-18 20:29:42 UTC
Andrew,

Yes, if more people can confirm that no side effect are generated by this patch. As i'm not use Gallery, i cannot test here. 

So, please users, test and report. Thanks in advance...

Gilles Caulier
Comment 9 Wolfgang Breyha 2012-09-18 21:07:27 UTC
Some more info to support my patch;-)

My gal2 (2.3.2 ... latest patchlevel) has the following 45 albums (simplified):
root node:
album.parent.7=0; album.name.7=7
... here album.name.ref_id and name is the same. But it's the only album where this is true ...
album.parent.1=.....
...
album.parent.5=7; album.name.5=20
...
album.parent.8=7; album.name.8=1453
....
album.parent.6=20; album.name.6=6448
album.parent.23=1453: album.name.23=12550
....
album.parent.45=.....

album.name.ref_num looks like a simple autoincrement value on g2. But it's not possible to build the tree with it. Because objects not linkable yet are feed back with workList.append(...) the endless loop is perfect since there are objects which are never linkable. eg album.23 above. There is no ref_id 1453 since 45 is the highest ref_id. But album.8 is the right choice.

Wolfgang
Comment 10 kaufman-kde 2012-09-21 01:41:30 UTC
(In reply to comment #5)
Patch works for me. Applied it to kipi-plugins-2.9.0, running on Gentoo Linux. Gallery is version 2.3.1. Thanks Wolfgang Breyha!

(Now that the patch is applied, I can see that the Gallery exporter is properly exporting the selected photos, rather than simply throwing up a file-selection dialog in the right directory. We lost the selected-photos functionality in, I think, KDE 4, so getting this back is a great improvement! Thanks to whoever did that work, too.)
Comment 11 caulier.gilles 2012-09-21 07:44:45 UTC
Git commit 9cb32d320a9c9cd9c8074154bd6cfa5e22b09c27 by Gilles Caulier.
Committed on 21/09/2012 at 09:43.
Pushed by cgilles into branch 'master'.

apply patch from Wolfgang Breyha to fix Gallery 2 infinite loop.
FIXED-IN: 3.0.0

M  +7    -2    galleryexport/gallerytalker.cpp

http://commits.kde.org/kipi-plugins/9cb32d320a9c9cd9c8074154bd6cfa5e22b09c27