gallery-app crashes after a few seconds opened

Bug #1470109 reported by Xavi Garcia
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Fix Released
High
Bill Filler
gallery-app (Ubuntu)
Fix Released
High
Arthur Mello
thumbnailer (Ubuntu)
Invalid
High
Unassigned

Bug Description

This happens using the new thumbnailer included in SILO 10, on the BQ.

To install the new thumbnailer from silo 10:
sudo apt-get update && sudo apt-get install thumbnailer-service

To recreate just copy 2000 photo files to the Pictures folder and open the gallery-app.
After a few seconds it crashes is most cases.

I've attached the .crash report obtained on the phone.

Backtrace (although symbols are not available it might add useful information):
Thread 16 (Thread 0xad5ff370 (LWP 28281)):
#0 0xb69db572 in ?? () from /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
No symbol table info available.
m-linux-gnueabihf/libQt5Core.so.5
No symbol table info available.
rm-linux-gnueabihf/libQt5Core.so.5
No symbol table info available.
#3 0x00053f4e in QString::QString(char const*) ()
No symbol table info available.
#4 0x0008328a in PhotoMetadata::fromFile(char const*) ()
No symbol table info available.
#5 0x000834e2 in PhotoMetadata::fromFile(QFileInfo const&) ()
No symbol table info available.
()
No symbol table info available.
#7 0x00061df6 in MediaObjectFactoryWorker::create(QString const&) ()
No symbol table info available.
#8 0x00061be0 in MediaObjectFactoryWorker::runCreate() ()
No symbol table info available.
ject::Call, int, void**) ()
No symbol table info available.
ibQt5Core.so.5
No symbol table info available.
/usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
No symbol table info available.
inux-gnueabihf/libQt5Widgets.so.5
No symbol table info available.
#13 0x00fa7020 in ?? ()
No symbol table info available.

Related branches

Revision history for this message
Xavi Garcia (xavi-garcia-mena) wrote :
Revision history for this message
James Henstridge (jamesh) wrote :

Here's the relevant Gallery-app method where the crash is occurring:

http://bazaar.launchpad.net/~phablet-team/gallery-app/trunk/view/head:/src/photoeditor/photo-metadata.cpp#L114

Unless there are some missing frames due to lack of debug info, it's from one of the two lines like:

            result->m_keysPresent.insert(QString(i->key().c_str()));

It's not clear what would cause that to crash though: the data is coming from a std::string, so should be safe. Ideally it'd be using QString::fromStdString(), but I wouldn't expect that to make a difference.

Revision history for this message
Michi Henning (michihenning) wrote :

I suspect that there are two issues here. Both need to be addressed, but in the right order.

The first problem (I think) is that the gallery app may be asking for more than it can eat. If the thumbnailer gets, say, 1000 requests for thumbnails, once the cache is hot, it'll deliver all the thumbnails very quickly. It should take about 1-1.5 seconds to return 1000 thumbnails on a Nexus 4. If the renderer cannot keep up, all those thumbnails pile up in memory and, by looks of things, gallery app falls over for lack of memory.

The second problem is that many of the requests have QSize(-1,-1). In response, the thumbnailer delivers 1920 sized thumbnails for photos and videos. Of course, that eats tons of extra memory and also makes the renderer work even harder, slowing things down further, which causes the memory starvation to mushroom out of control.

Asking for thumbnails in the correct size is necessary and will probably make the problem disappear. BUT: the underlying real problem seems to be that the gallery app asks for more than it can eat. So, even with thumbnails of the correct size, I think the memory pile-up issue could potentially persist. So, before addressing problem 2, it might be a good idea to look at problem 1 and check whether an "unreasonably" large number of requests can be issued to the thumbnailer. If so, limiting the amount of data the gallery app asks for would attack the root problem, I believe.

Once the root problem is solved, asking for thumbnails in the correct size will make a big difference to the user experience, to battery life, and to the hit rate on the cache. So both problems are worth solving.

Changed in gallery-app:
importance: Undecided → High
Changed in thumbnailer:
importance: Undecided → High
Revision history for this message
Xavi Garcia (xavi-garcia-mena) wrote :

The issue has been observed as well in krillin with wily and the previous (current) thumbnailer.
No need to install the one from silo 10.

Revision history for this message
Michi Henning (michihenning) wrote :

I'm leaving this open for thumbnailer even though it isn't a thumbnailer problem. Please don't mark as Invalid for thumbnailer until the bug is fixed.

Bill Filler (bfiller)
Changed in canonical-devices-system-image:
milestone: none → ww34-2015
assignee: nobody → Bill Filler (bfiller)
importance: Undecided → High
Changed in gallery-app:
assignee: nobody → Arthur Mello (artmello)
Sturm Flut (sturmflut)
Changed in gallery-app:
status: New → Confirmed
no longer affects: gallery-app (Ubuntu)
affects: gallery-app → gallery-app (Ubuntu)
Revision history for this message
Bill Filler (bfiller) wrote :

Related bug, guessing it's a dupe but leaving separate for now:
https://bugs.launchpad.net/ubuntu/+source/gallery-app/+bug/1475210

Arthur Mello (artmello)
Changed in gallery-app (Ubuntu):
status: Confirmed → In Progress
Bill Filler (bfiller)
Changed in canonical-devices-system-image:
status: New → In Progress
Revision history for this message
Bill Filler (bfiller) wrote :

can't land the fix for this crash until the fixes for https://bugs.launchpad.net/canonical-devices-system-image/+bug/1484914 land as there is a memory leak in ImageProvider that gets exposed by the fix

Bill Filler (bfiller)
Changed in canonical-devices-system-image:
milestone: ww34-2015 → ww40-2015
Revision history for this message
Michi Henning (michihenning) wrote :

Setting to triaged for thumbnailer so we can track it.

Silo 15 has just received QA approval, so it should land within the next few hours, I would hope. That version contains the memory leak fix.

Changed in thumbnailer:
status: New → Triaged
Changed in canonical-devices-system-image:
milestone: ww40-2015 → ww46-2015
Revision history for this message
Bill Filler (bfiller) wrote :

All the dependent fixes have landed, but we are now seeing this new thumbnailer issue:
https://bugs.launchpad.net/thumbnailer/+bug/1501349

Until that is fixed, landing the gallery fix is on hold

Changed in canonical-devices-system-image:
milestone: ww46-2015 → backlog
Revision history for this message
Michi Henning (michihenning) wrote :

Don't worry about the log messages, they are benign. There is a problem with request cancellation underneath that, which I'm working on. But I don't think it should stop gallery-app.

Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

Looks like this should land then

Changed in canonical-devices-system-image:
milestone: backlog → ww46-2015
milestone: ww46-2015 → none
Revision history for this message
Michi Henning (michihenning) wrote :

Yes, I think so. I'm still working on the underlying cancellation issue. It turns out that a bug in our code meant that a cancel() sent to the thumbnail actually didn't cancel. That's benign because, if a request isn't cancelled, it completes normally and the result is ignored when the request finishes. (It just means that the thumbnailer potentially does some work that it was asked not to do.)

After fixing the bug in our code so requests are indeed cancelled, I'm seeing major problems in both gallery and camera apps if there are lots of images and I scroll quickly through a bunch of thumbnails. It's not yet clear whether that is a thumbnailer problem or something at the QML widget level. We are in the process of tracking it down.

At any rate, we won't land the cancel fix until we are sure that it won't break anything, so go ahead and land this gallery app change please.

Revision history for this message
Michi Henning (michihenning) wrote :

The cancel problem was with the thumbnailer and is fixed now. Sitting in silo 40. So, please land your fix too.

Changed in thumbnailer (Ubuntu):
status: New → Triaged
importance: Undecided → High
no longer affects: thumbnailer
Changed in canonical-devices-system-image:
milestone: none → ww46-2015
Changed in canonical-devices-system-image:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gallery-app - 0.0.67+16.04.20151106-0ubuntu1

---------------
gallery-app (0.0.67+16.04.20151106-0ubuntu1) xenial; urgency=medium

  [ Arthur Mello ]
  * Update QML code to work with Ubuntu.Components 1.3 (LP: #1508363)
  * Use a Loader for OrganicMediaLst delegates to avoid crashes when
    loading multiple files (LP: #1475210, #1470109)

  [ CI Train Bot ]
  * New rebuild forced.

 -- Bill Filler <email address hidden> Fri, 06 Nov 2015 14:05:26 +0000

Changed in gallery-app (Ubuntu):
status: In Progress → Fix Released
Changed in canonical-devices-system-image:
status: Fix Committed → Fix Released
Changed in thumbnailer (Ubuntu):
status: Triaged → Invalid
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.