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 756877 - tracker-file-notifier: Fix the lifetime of the internal async operations
tracker-file-notifier: Fix the lifetime of the internal async operations
Status: RESOLVED FIXED
Product: tracker
Classification: Core
Component: Miners
1.6.x
Other All
: Normal normal
: ---
Assigned To: tracker-general
tracker-general
Depends on:
Blocks:
 
 
Reported: 2015-10-20 15:45 UTC by Debarshi Ray
Modified: 2015-10-20 17:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
libtracker-miner: Abort async operations once the instance is gone (2.32 KB, patch)
2015-10-20 15:50 UTC, Debarshi Ray
committed Details | Review
libtracker-miner: Cancel pending async operations during destruction (911 bytes, patch)
2015-10-20 16:09 UTC, Debarshi Ray
committed Details | Review
[tracker-1.4] libtracker-miner: Abort async operations once the instance is gone (2.31 KB, patch)
2015-10-20 17:53 UTC, Debarshi Ray
committed Details | Review
[tracker-1.2] libtracker-miner: Abort async operations once the instance is gone (2.31 KB, patch)
2015-10-20 17:54 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2015-10-20 15:45:41 UTC
The internal async operations in TrackerFileNotifier don't take a ref on the instance to keep it alive. Instead, they are controlled by a private GCancellable, which is supposed to be cancelled when the instance is destroyed.

Therefore, we cannot touch the instance once G_IO_ERROR_CANCELLED has been raised because it has been destroyed.

Secondly, it is not obvious to me that the private GCancellable is actually cancelled during destruction. It is important because merely unreffing it won't cancel it, and the async operations won't know that the instance is gone.
Comment 1 Debarshi Ray 2015-10-20 15:50:18 UTC
Created attachment 313760 [details] [review]
libtracker-miner: Abort async operations once the instance is gone
Comment 2 Debarshi Ray 2015-10-20 16:07:53 UTC
(In reply to Debarshi Ray from comment #0) 
> Secondly, it is not obvious to me that the private GCancellable is actually
> cancelled during destruction. It is important because merely unreffing it
> won't cancel it, and the async operations won't know that the instance is
> gone.

I am sure that it is not being cancelled.

g_cancellable_cancel is only called from tracker_file_notifier_stop and indexing_tree_directory_removed; and g_cancellable_reset is only called from crawl_directory_in_current_root. None of these are called before we drop the reference in finalize.
Comment 3 Debarshi Ray 2015-10-20 16:09:33 UTC
Created attachment 313764 [details] [review]
libtracker-miner: Cancel pending async operations during destruction
Comment 4 Carlos Garnacho 2015-10-20 17:07:59 UTC
Review of attachment 313760 [details] [review]:

Looks good to me. Keep in mind I just branched yesterday :)
Comment 5 Carlos Garnacho 2015-10-20 17:08:17 UTC
Review of attachment 313764 [details] [review]:

Yup
Comment 6 Debarshi Ray 2015-10-20 17:53:37 UTC
Created attachment 313769 [details] [review]
[tracker-1.4] libtracker-miner: Abort async operations once the instance is gone
Comment 7 Debarshi Ray 2015-10-20 17:54:36 UTC
Created attachment 313770 [details] [review]
[tracker-1.2] libtracker-miner: Abort async operations once the instance is gone
Comment 8 Debarshi Ray 2015-10-20 17:57:56 UTC
Thanks Carlos. Pushed to master, tracker-1.6, tracker-1.4 and tracker-1.2.