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 781252 - Incomplete enumeration after cancelled operation
Incomplete enumeration after cancelled operation
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: google backend
git master
Other Linux
: Normal normal
: ---
Assigned To: Debarshi Ray
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2017-04-13 08:55 UTC by Ondrej Holy
Modified: 2017-04-21 07:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
google: Do not ignore errors when rebuilding cache (1.63 KB, patch)
2017-04-13 08:55 UTC, Ondrej Holy
committed Details | Review

Description Ondrej Holy 2017-04-13 08:55:09 UTC
If file cache is not reloaded properly (e.g. because of cancellation), it may lead to various problems (e.g. incomplete enumeration).
Comment 1 Ondrej Holy 2017-04-13 08:55:49 UTC
Created attachment 349768 [details] [review]
google: Do not ignore errors when rebuilding cache

If file cache is not loaded properly (e.g. because of cancellation),
it may lead to various problems (e.g. incomplete enumeration). Let's
return error in such case and rebuild the cache next time...
Comment 2 Ondrej Holy 2017-04-13 08:56:17 UTC
Rishi, don't you remember whether there isn't any special reason why errors are ignored when rebuilding the cache (if a partial response is already received)?
Comment 3 Debarshi Ray 2017-04-13 12:05:10 UTC
The idea was to make the code a bit robust against transient network and server errors. If we managed to make initial contact with Google Drive, we'd ignore any following error but stop requesting any further batches. It was based on the approach that gnome-documents uses [1] to keep its local metadata cache updated.

But cancellation is an interesting case. :) I didn't think about it.

Maybe we can special case (G_IO_ERROR, G_IO_ERROR_CANCELLED) ?

I am curious how you reproduced it and what kind of consequences it had. Just trying to understand it.

[1] https://git.gnome.org/browse/gnome-online-miners/tree/src/gom-gdata-miner.c#n938
Comment 4 Ondrej Holy 2017-04-13 15:50:04 UTC
(In reply to Debarshi Ray from comment #3)
> The idea was to make the code a bit robust against transient network and
> server errors. If we managed to make initial contact with Google Drive, we'd
> ignore any following error but stop requesting any further batches. It was
> based on the approach that gnome-documents uses [1] to keep its local
> metadata cache updated.
> 
> But cancellation is an interesting case. :) I didn't think about it.
> 
> Maybe we can special case (G_IO_ERROR, G_IO_ERROR_CANCELLED) ?

I don't think that we want to handle the cancellation differently here. The potential network error has same consequences as the cancellation. Other backends also return some error in the case of network error...

> I am curious how you reproduced it and what kind of consequences it had.
> Just trying to understand it.

1/ Open Nautilus.
2/ Click on <username>@gmail.com in the sidebar.
3/ Press back button once it is active.
(It has to be after the initial batch is received and before the enumeration is done, so you need more than 50 files on your drive at least, it is easy if you have tons of files as me).
4/ Click on <username>@gmail.com in the sidebar again.
5/ Subset of files is shown (until next enumeration after 60 seconds) without any error, which is pretty confusing.

(I saw also some weird behavior when doing some operations with the incomplete list, but I don't recall what exactly.)

> [1]
> https://git.gnome.org/browse/gnome-online-miners/tree/src/gom-gdata-miner.
> c#n938

Will look...
Comment 5 Debarshi Ray 2017-04-13 15:56:32 UTC
(In reply to Ondrej Holy from comment #4)
> I don't think that we want to handle the cancellation differently here. The
> potential network error has same consequences as the cancellation. Other
> backends also return some error in the case of network error...

Ok, if other backends don't try to recover from network errors, then I guess the Drive backend need not do it either. I don't have any strong opinion about it. Up to you - whatever you think is best.
Comment 6 Ondrej Holy 2017-04-21 07:58:36 UTC
Thanks for your comment. I think it is better to let users manually refresh directory after the error, than silently ignore the errors and show just a subset of files (even when reloading)...
Comment 7 Ondrej Holy 2017-04-21 07:59:10 UTC
Attachment 349768 [details] pushed as be643b7 - google: Do not ignore errors when rebuilding cache