Bug 351658 - Prevent to fill whole memory when all CPU cores are used to process Maintenance tools
Summary: Prevent to fill whole memory when all CPU cores are used to process Maintenan...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Maintenance-Thumbs (show other bugs)
Version: 4.12.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-23 17:23 UTC by Bizy
Modified: 2019-09-17 16:47 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.4.0


Attachments
crash report (part 1) (161.57 KB, image/jpeg)
2015-09-03 17:51 UTC, Bizy
Details
crash report (part 2) (25.90 KB, image/jpeg)
2015-09-03 17:51 UTC, Bizy
Details
Message from Program Installer (part 1) (23.42 KB, image/jpeg)
2015-09-03 17:56 UTC, Bizy
Details
Message from Program Installer (part 2) (56.54 KB, image/jpeg)
2015-09-03 17:56 UTC, Bizy
Details
Message from Program Installer (part 3) (93.02 KB, image/jpeg)
2015-09-03 17:57 UTC, Bizy
Details
Update proposal (168.93 KB, image/jpeg)
2015-09-03 17:59 UTC, Bizy
Details
Crash report (after update proposal) (48.75 KB, image/jpeg)
2015-09-03 18:00 UTC, Bizy
Details
After recommended command (238.90 KB, image/jpeg)
2015-09-03 18:05 UTC, Bizy
Details
Crash report (2, part 1) (114.96 KB, image/jpeg)
2015-09-03 18:09 UTC, Bizy
Details
Crash report (2, part 2) (49.25 KB, image/jpeg)
2015-09-03 18:10 UTC, Bizy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bizy 2015-08-23 17:23:10 UTC
Whatever maintenance taks I choose (thumbnails or metadata or... small or big albums... with all cores used or not):  the program starts using all available memory.  Endlessly.  And whenever I got the patience to wait it out:  silently disappears...

Reproducible: Always

Steps to Reproduce:
1. Choose Maintenance
2. Choose album(s)/task(s).


Actual Results:  
Nothing happens.  After lots of time:  program crashes (no crash report).

Expected Results:  
Doing maintenance.  (Without having to work around it, for that is possible:  fi, opening an album (subtree included), selecting all images, and than synchronising metadata via File/Write metadata to file.)

Nothing I can think of.

I have Debug Symbols installed.  But mostly, the crash reporter itself... crashes.  Or doesn't come up with a useful crash report...  (that's a separate issue).

And as said:  I don't get a crash message for this problem anyway.

I haven't gotten into Valgrind yet.
Comment 1 caulier.gilles 2015-08-24 05:26:54 UTC
Maik, 

To prevent this problem, we need a function which will check whole available memory and compute how many CPU core be used at the same time without to fill all memory.

The same problem exist in BQM...

Gilles
Comment 2 Bizy 2015-09-01 22:36:05 UTC
So I downgraded to 4.0... :-(
I'm doing what's necessary to (try) to save all the work that hasn't been saved into the images yet.  And then I'll create a new database and will give feedback about wether I'm able to do maintenance or not...

(The program became so time consuming...  The database became as big as 9GB, it took 5 to 10 minutes before loading.  I tried to remove a big part of this 'collection', but it didn't reduce the loading time, didn't remove tons of tags (while the images were removed)...  The slightest action (like changing a setting or writing the tag of one image) and the program kept hanging or crashed...  The menu disappeared (Ctrl + M didn't work, 'Show menubar' didnt work... - I had to remove and reinstall the 'show menubar'-button to make the menu visible...)
And so on...
No possibility to create crash reports (in spite of having bug symbols installed), or the crash reporter itself crashing...
I had enough of it...

Still hoping that I can keep using Digikam, coz only Digikam has all possible functionality that I need - all, and more than I could think of...
Comment 3 Bizy 2015-09-02 01:30:42 UTC
PS:  I don't know who changed the title, but this doesn't reflect anymore what happened.  Only one core was 'hijacked' by Digikam (so using 100%, sometimes switching to another core - I have 8 cores in total).  Total use of CPU was only about 12 %.
Comment 4 Maik Qualmann 2015-09-02 19:15:51 UTC
Which version of digikam you used? Which database was 9 GB great, digikam4.db or thumbnails-digikam.db?

Maik
Comment 5 Bizy 2015-09-02 20:30:43 UTC
(In reply to Maik Qualmann from comment #4)
> Which version of digikam you used? Which database was 9 GB great,
> digikam4.db or thumbnails-digikam.db?
> 
> Maik

Digikam Version 4.12
Ubuntu Versiion 14.04
Processor:  Intel® Core™ i7-4710MQ CPU @ 2.50GHz × 8
System:  64 bit
Comment 6 Bizy 2015-09-02 20:38:06 UTC
So I can confirm that I can do maintenance again...  :-)  (with downgrade to Version 4.0)
(though it takes awfully long;  for now (about 13.000 images), it takes hours and hours to write the tags from the images to the database, I wonder if that's regular...  but most importantly, it works...!)

So somewhere along the installation process of version 4.12, something goes wrong...
(I followed these guidelines:  <a>http://ubuntuhandbook.org/index.php/2015/08/install-latest-digikam-4-12-ubuntu/</a>  
And I installed both packages (extra and kubuntu backports)
I'm not ready yet to try it again (too much work to do with a stable program)... But one day, I will...
Comment 7 caulier.gilles 2015-09-02 20:46:04 UTC
Downgrading digiKam will certainly downgrade other components, as Exiv2 library. With previous 0.24.0 release a lots of bugs have been introduced. Using previous version do not have these problems. Writing metadata to image use Exiv2 a lots.

Exiv2 0.25.0 fix the problem. This version must be used with digiKam 4.12.0...

Note : your problem sound like completely different than report title, but my title changes are true. If you run maintenance tools with all CPU core, there is no check to see how many memory is available to process, and all is filled. Here with 16 or 32 GB, there are no problem to run 8 threads with a i7 cpu, but with 8 or 4 Gb, it's completely different.

Gilles Caulier
Comment 8 Bizy 2015-09-02 21:33:34 UTC
(In reply to Gilles Caulier from comment #7)
> Downgrading digiKam will certainly downgrade other components, as Exiv2
> library. With previous 0.24.0 release a lots of bugs have been introduced.
> Using previous version do not have these problems. Writing metadata to image
> use Exiv2 a lots.
> 
> Exiv2 0.25.0 fix the problem. This version must be used with digiKam
> 4.12.0...
> 
> Note : your problem sound like completely different than report title, but
> my title changes are true. If you run maintenance tools with all CPU core,
> there is no check to see how many memory is available to process, and all is
> filled. Here with 16 or 32 GB, there are no problem to run 8 threads with a
> i7 cpu, but with 8 or 4 Gb, it's completely different.
> 
> Gilles Caulier

Thanks, Gilles, for your comment!

1) Regarding Exiv:  can you tell me how to do this upgrade step by step (or send me a link)?  Of course, I know about this problem, it's been reported often.  But then again:  I didn't find any clear (meaning:  clear to me) instructions on how to upgrade, as it got too technical.  I tried (or actually did) upgrade exiv with the terminal, but I wonder if that's enough.  There seem to be isues with older parts that need to be removed in another way... That's where the too technical part starts...

2)  Regarding the title:  fine to me!  As long as it's clear enough for you guys to idenitfy the problem... ;-)
Seems that I have to regret I didn't order more memory then? :-(
But I read about the 'same' (at least regarding memory leak) problem for someone with 32GB of memory... (same behaviour, gradually using it all, and then crashing or disappearing...)
(tried to google it, but can't find it for now)
Comment 9 Bizy 2015-09-03 01:05:26 UTC
(In reply to Bizy from comment #5)
> (In reply to Maik Qualmann from comment #4)
> > Which version of digikam you used? Which database was 9 GB great,
> > digikam4.db or thumbnails-digikam.db?
> > 
> > Maik
> 
> Digikam Version 4.12
> Ubuntu Versiion 14.04
> Processor:  Intel® Core™ i7-4710MQ CPU @ 2.50GHz × 8
> System:  64 bit

O, and i forgot:  the large database is (was) thumbnails-digikam.db
Comment 10 Bizy 2015-09-03 16:43:47 UTC
So, after 7 (!) hours, only 11% of the 'maintenance' (writing tags to new database, in version 4.0, 8-core processor, 8GB memory)  is done.  Is that how it is supposed to be?  (that would supprise me...)  
Should I create a new bug report?  Or is this hopelessly outdated? (as it is about verson 4.0)
I really don't know what to do...
Comment 11 caulier.gilles 2015-09-03 16:48:23 UTC
This kind of dysfunction have been already reported in the past.

I recommend to use 4.12.0 with right Exiv2 0.25 to prevent crashes.

Gilles Caulier
Comment 12 Bizy 2015-09-03 17:36:49 UTC
Okay, thanks, I know.
And then, how?
Apparently I have version 0.23.  And I need version 0.25.  And there is the issue of files of the old version still being used...
I found this tutorial:  http://dev.exiv2.org/projects/exiv2/wiki/Building_on_Ubuntu_using_Cmake
(It's this kind of step by step, command line by command line guide that I need.
But at step 3, it stops ('http://dev.exiv2.org/svn/trunk' doesn't exist anymore).
So then what?



(In reply to Gilles Caulier from comment #11)
> This kind of dysfunction have been already reported in the past.
> 
> I recommend to use 4.12.0 with right Exiv2 0.25 to prevent crashes.
> 
> Gilles Caulier
Comment 13 Bizy 2015-09-03 17:40:37 UTC
There is this page of exiv2 itself (http://www.exiv2.org/download.html)
But when I download the package, I don't find a .sh-file.
And then I don't find the file I need -according to the guide - to make the .sh-file...
Honestly...

(In reply to Bizy from comment #12)
> Okay, thanks, I know.
> And then, how?
> Apparently I have version 0.23.  And I need version 0.25.  And there is the
> issue of files of the old version still being used...
> I found this tutorial: 
> http://dev.exiv2.org/projects/exiv2/wiki/Building_on_Ubuntu_using_Cmake
> (It's this kind of step by step, command line by command line guide that I
> need.
> But at step 3, it stops ('http://dev.exiv2.org/svn/trunk' doesn't exist
> anymore).
> So then what?
> 
> 
> 
> (In reply to Gilles Caulier from comment #11)
> > This kind of dysfunction have been already reported in the past.
> > 
> > I recommend to use 4.12.0 with right Exiv2 0.25 to prevent crashes.
> > 
> > Gilles Caulier
Comment 14 Bizy 2015-09-03 17:50:16 UTC
And when I try to reinstall digiKam 4.12, I get a crash report (see screenshot).
(using this guide:  http://ubuntuhandbook.org/index.php/2015/08/install-latest-digikam-4-12-ubuntu/)

(In reply to Bizy from comment #13)
> There is this page of exiv2 itself (http://www.exiv2.org/download.html)
> But when I download the package, I don't find a .sh-file.
> And then I don't find the file I need -according to the guide - to make the
> .sh-file...
> Honestly...
> 
> (In reply to Bizy from comment #12)
> > Okay, thanks, I know.
> > And then, how?
> > Apparently I have version 0.23.  And I need version 0.25.  And there is the
> > issue of files of the old version still being used...
> > I found this tutorial: 
> > http://dev.exiv2.org/projects/exiv2/wiki/Building_on_Ubuntu_using_Cmake
> > (It's this kind of step by step, command line by command line guide that I
> > need.
> > But at step 3, it stops ('http://dev.exiv2.org/svn/trunk' doesn't exist
> > anymore).
> > So then what?
> > 
> > 
> > 
> > (In reply to Gilles Caulier from comment #11)
> > > This kind of dysfunction have been already reported in the past.
> > > 
> > > I recommend to use 4.12.0 with right Exiv2 0.25 to prevent crashes.
> > > 
> > > Gilles Caulier
Comment 15 Bizy 2015-09-03 17:51:13 UTC
Created attachment 94376 [details]
crash report (part 1)
Comment 16 Bizy 2015-09-03 17:51:39 UTC
Created attachment 94377 [details]
crash report (part 2)
Comment 17 Bizy 2015-09-03 17:56:01 UTC
Created attachment 94378 [details]
Message from Program Installer (part 1)
Comment 18 Bizy 2015-09-03 17:56:26 UTC
Created attachment 94379 [details]
Message from Program Installer (part 2)
Comment 19 Bizy 2015-09-03 17:57:02 UTC
Created attachment 94380 [details]
Message from Program Installer (part 3)
Comment 20 Bizy 2015-09-03 17:59:41 UTC
Created attachment 94381 [details]
Update proposal
Comment 21 Bizy 2015-09-03 18:00:08 UTC
Created attachment 94382 [details]
Crash report (after update proposal)
Comment 22 Bizy 2015-09-03 18:05:39 UTC
Created attachment 94383 [details]
After recommended command

(the feedback message says:  execute 'apt-get install -f')

And then, I'm totally stuck... (loops of the same) :-(
So far for trying to upgrade my dearest program...
Comment 23 Bizy 2015-09-03 18:09:39 UTC
Created attachment 94384 [details]
Crash report (2, part 1)
Comment 24 Bizy 2015-09-03 18:10:13 UTC
Created attachment 94385 [details]
Crash report (2, part 2)
Comment 25 Bizy 2015-09-04 17:05:09 UTC
A miracle happened: 'all of a sudden' I had version 4.12 working, with exiv2 0.25.  And it worked fine, even maintenance (although slow).
(Unfortunately, I wouldn't know how to reproduce this.)
But then (I will save the details - probably becoz of Picasa in Wine), my disk was irremediably full...  All methods I know (like really cleaning the bin, removing achives of installed programs and so on...) didn't work, couldn't find the database of Picasa... and so on...
So a complete reinstall seemed to be more timefriendly than one more search for an unforeseen mysterious problem.
So, I did a complete reinstall.
To resume that new story (of course, I tried to install digiKam version 4.12, wíth exiv2 0.25):  I end up with version 3.5 ánd exiv2 0.25... :-(
So I'll make a new post of this in the Ubuntu help forums (in more detail), to get to specifically know:  how to install digiKam 4.12 in a freshly installed Ubuntu 14.04 (after the updates the system proposes)?
Coz these instructions obviously don't work:  http://ubuntuhandbook.org/index.php/2015/08/install-latest-digikam-4-12-ubuntu/
I get messages about libkgeomap2 en kipi-plugins ('broken packages')
In the launcher I get messages about digikam-data.  (And it only worked by excluding the repositories of philip5 and kubuntu-backports.  But then I needed to reinclude them, to get exiv2 0.25 instead of 0.23).  And so on...  Needless to say:  this is all very frustrating... :-(
Comment 26 Bizy 2015-09-04 18:25:25 UTC
(In reply to Bizy from comment #25)
> A miracle happened: 'all of a sudden' I had version 4.12 working, with exiv2
> 0.25.  And it worked fine, even maintenance (although slow).
> (Unfortunately, I wouldn't know how to reproduce this.)
> But then (I will save the details - probably becoz of Picasa in Wine), my
> disk was irremediably full...  All methods I know (like really cleaning the
> bin, removing achives of installed programs and so on...) didn't work,
> couldn't find the database of Picasa... and so on...
> So a complete reinstall seemed to be more timefriendly than one more search
> for an unforeseen mysterious problem.
> So, I did a complete reinstall.
> To resume that new story (of course, I tried to install digiKam version
> 4.12, wíth exiv2 0.25):  I end up with version 3.5 ánd exiv2 0.25... :-(
> So I'll make a new post of this in the Ubuntu help forums (in more detail),
> to get to specifically know:  how to install digiKam 4.12 in a freshly
> installed Ubuntu 14.04 (after the updates the system proposes)?
> Coz these instructions obviously don't work: 
> http://ubuntuhandbook.org/index.php/2015/08/install-latest-digikam-4-12-
> ubuntu/
> I get messages about libkgeomap2 en kipi-plugins ('broken packages')
> In the launcher I get messages about digikam-data.  (And it only worked by
> excluding the repositories of philip5 and kubuntu-backports.  But then I
> needed to reinclude them, to get exiv2 0.25 instead of 0.23).  And so on... 
> Needless to say:  this is all very frustrating... :-(

But then, when I restarted the program, no more Digikam...  Same problem...  And excluding the repositories doesn't help...  Same problem with launcher... So totally blocked... no version at all...
Comment 27 Bizy 2015-09-04 21:19:59 UTC
Back to version 3.5, exiv2 0.25.

Regarding exiv2 (for whoever that might benefit from it, struggling with similar exiv2-related issues).
What I would have liked to hear from someone (at least, this is something that seems to work):
- Install Synaptic Package Manager from launcher (Ubuntu Software Center)
- Search for exiv2
- In menu:  choose Package/Force Version (to choose version 0.25)
- Apply
Comment 28 Bizy 2015-09-11 00:22:15 UTC
Somehow I managed to install version 4.13, but I don't know if it's reproducible.

So with Ubuntu 4.14 freshly reinstalled, I:
- install this repository:  sudo add-apt-repository ppa:philip5/extra  (only this one)
- remove broken packages (with synaptic)
- wait till the update manager allows me to do a partial update 
- install Digikam from the launcher 

No problems so far... (but didn't make any big moves...)
Comment 29 Bizy 2015-09-11 00:23:58 UTC
(In reply to Bizy from comment #28)
> So with Ubuntu 4.14 freshly reinstalled

Of course, I mean Ubuntu 14.04
Comment 30 Bizy 2015-09-11 14:59:17 UTC
Just found out that the 'system' offered an update (that I accepted) of exiv2 that actually is a downgrade - it installs 0.23.
But I when I want to remove it (using Synaptic), it also wants the remove lots of programs involved (including Digikam).
Comment 31 Mario Frank 2017-02-22 15:10:48 UTC
Git commit 2f8ddd42ef62d7aea9e490cdb05ffcc644810c81 by Mario Frank.
Committed on 22/02/2017 at 15:05.
Pushed by mfrank into branch 'master'.

Merged the current state of the garbage collection branch which improves the database cleanup stage of the maintenance
and improves the reactiveness of the maintenance overall. We ported the way items are processed to a queue based method
that can use the CPUs more effectively and does not create thousands of threads.
Related: bug 283062, bug 216895, bug 374225, bug 362023, bug 329353
FIXED-IN: 5.5.0

M  +17   -12   NEWS

https://commits.kde.org/digikam/2f8ddd42ef62d7aea9e490cdb05ffcc644810c81
Comment 32 Mario Frank 2017-02-28 16:07:12 UTC
Potentially, your problems could be solved in the current AppImage as I restricted the count of threads that are opened in maintenance. 

Can you test that?

The AppImages are stored here by Gilles:
https://drive.google.com/drive/folders/0BzeiVr-byqt5Y0tIRWVWelRJenM
Comment 33 Maik Qualmann 2019-09-17 16:47:26 UTC
This bug can not be reproduced with digiKam-6.4.0, so I close the bug. If necessary, reopen it.

Maik