After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 775713 - async metadata store seems to finalize media objects
async metadata store seems to finalize media objects
Status: RESOLVED OBSOLETE
Product: grilo
Classification: Other
Component: core
git master
Other Linux
: Normal normal
: ---
Assigned To: grilo-maint
grilo-maint
Depends on:
Blocks:
 
 
Reported: 2016-12-06 14:12 UTC by Marinus Schraal
Modified: 2018-09-24 09:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
make metadata store async (3.31 KB, patch)
2016-12-06 14:12 UTC, Marinus Schraal
none Details | Review
gdb backtrace of the segfault (33.36 KB, text/plain)
2016-12-06 14:15 UTC, Marinus Schraal
  Details

Description Marinus Schraal 2016-12-06 14:12:27 UTC
Created attachment 341480 [details] [review]
make metadata store async

I added metadata storage to tracker through grilo in gnome-music recently. Making the calls sync works, async however they fail and segfault. It seems the original media object is in some cases finalized in the latter case.

The patch supplied is to make the calls async in gnome-music git master, reproduce by selecting an album and starring/unstarring a track of the album (3 clicks should suffice).

GRL_DEBUG=media:* with the patch produces :


-- 1st click --
<__gi__.GrlTrackerSource object at 0x7fd605397c60 (GrlTrackerSource at 0x2053840)> <Grl.Media object at 0x7fd6041b2bd0 (GrlMedia at 0x5174a20)> [] <Grl.Media object at 0x7fd6041b2bd0 (GrlMedia at 0x5174a20)> None
-- 2nd click --
<__gi__.GrlTrackerSource object at 0x7fd605397c60 (GrlTrackerSource at 0x2053840)> <Grl.Media object at 0x7fd6041b2bd0 (GrlMedia at 0x5174a20)> [] <Grl.Media object at 0x7fd6041b2bd0 (GrlMedia at 0x5174a20)> None
(gnome-music:8895): Grilo-DEBUG: [media] data/grl-media.c:140: grl_media_finalize (I Know Places)
(gnome-music:8895): Grilo-DEBUG: [media] data/grl-media.c:140: grl_media_finalize ((null))
-- 3rd click --
Segmentation fault (core dumped)

and without produces:

-- 1st click --
(gnome-music:9211): Grilo-DEBUG: [media] data/grl-media.c:140: grl_media_finalize ((null))
-- 2nd click --
(gnome-music:9211): Grilo-DEBUG: [media] data/grl-media.c:140: grl_media_finalize ((null))
(gnome-music:9211): Grilo-DEBUG: [media] data/grl-media.c:140: grl_media_finalize ((null))
-- 3rd click --
(gnome-music:9211): Grilo-DEBUG: [media] data/grl-media.c:140: grl_media_finalize ((null))
(gnome-music:9211): Grilo-DEBUG: [media] data/grl-media.c:140: grl_media_finalize ((null))
-- etc --
Comment 1 Marinus Schraal 2016-12-06 14:15:04 UTC
Created attachment 341481 [details]
gdb backtrace of the segfault
Comment 2 Victor Toso 2016-12-06 15:06:38 UTC
Are you destroying the GrlMedia afterwards? I can see that GrlTracker does not increase the reference count of it and it probably should.

Btw, quite hard to follow this backtrace from python. I don't see any grl functions there.
Comment 3 Marinus Schraal 2016-12-06 15:26:25 UTC
We're not destroying it and yeah the backtrace is rather useless and doesn't show anything grilo related. But the object referenced in frame 0 is the grl media object (same address). However this backtrace is at the point where the object is already gone (click 3), so it is just the reason of the segfault. The real problem is at click 2 afaics. (btw, yeah there might be an interaction with the python gc)

Notice how in the async case the debug output finalizes the media (it shows the title) and in the sync case it doesn't.

The api docs at least mention nothing about a need to increase the refcount on storing objects, I'm not sure the internal api is any different. And it doesn't really explain the discrepancy between the sync/async case. Note that in all cases here I'm only pushing 1 key for 1 media at a time and it is slightly odd that it triggers 2 finalizes after the 1st click.
Comment 4 Victor Toso 2016-12-06 15:54:16 UTC
What I mean with comment #2 is that the plugin most likely should increase the refcount of GrlMedia and it doesn't, so it is a bug in tracker plugin.

I'll take a closer look now and see if I can make a patch. (pity that we don't have tests for tracker)
Comment 5 Bastien Nocera 2016-12-07 16:20:31 UTC
Having a test case that doesn't involve running gnome-music would be useful, so would running that test case under valgrind, which would show where the object is used and where it was freed.
Comment 6 GNOME Infrastructure Team 2018-09-24 09:51:28 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/grilo/issues/107.