Merge lp://staging/~facundo/ubuntuone-client/lr-udf-not-found into lp://staging/ubuntuone-client

Proposed by Facundo Batista
Status: Merged
Approved by: Tim Cole
Approved revision: 442
Merged at revision: not available
Proposed branch: lp://staging/~facundo/ubuntuone-client/lr-udf-not-found
Merge into: lp://staging/ubuntuone-client
Diff against target: 136 lines (+74/-8)
2 files modified
tests/syncdaemon/test_localrescan.py (+37/-1)
ubuntuone/syncdaemon/local_rescan.py (+37/-7)
To merge this branch: bzr merge lp://staging/~facundo/ubuntuone-client/lr-udf-not-found
Reviewer Review Type Date Requested Status
Tim Cole (community) Approve
Rodrigo Moya (community) Approve
Review via email: mp+21974@code.staging.launchpad.net

Commit message

Unsubscribe an UDF when it's not found just before adding inotify watches.

Description of the change

Unsubscribe an UDF when it's not found just before adding inotify watches.

This covers the case of "stopping the client, removing the UDF, starting the client again", that previously provoked infinite LR_SCAN_ERROR loops.

To post a comment you must log in.
Revision history for this message
Tim Cole (tcole) wrote :

Hmm. Not sure that adding an os.access check beforehand covers it. What happens if someone deletes/chmods/etc the directory between the call to os.access but before _add_watches_to_udf_ancestors completes? Seems like it would hit the same loop as before.

review: Needs Fixing
Revision history for this message
Tim Cole (tcole) wrote :

(This might happen in practice if e.g. the user were doing bulk permissions changes/moves/deletions while syncdaemon just happened to be in this part of the code.)

Revision history for this message
Tim Cole (tcole) wrote :

(It seems like the correct fix would be to make _add_watches_to_udf_ancestors robustly raise an exception if the directory is gone or disappears out from under it, then catch that exception to do the unsubscribe.)

442. By Facundo Batista

Refactored check to include ancestors.

Revision history for this message
Facundo Batista (facundo) wrote :

Tim: Thanks for your comment!

I refactored the check, and now I do the following:

- Start to adding watches to the ancestors (if some of the ancestors is not there, the whole subtree was moved or deleted, so I revert stuff (see below))

- When finished with ancestors, check the UDF itself (if not there, also revert stuff).

"revert stuff" means removing the added watches (not the watches of all ancestors, but only the added ones, because ancestors can be shared between UDFs) and unsubscribing the UDF.

Could you please review it again?

Thank you very much!

Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

All tests pass, and Tim's comment was addressed, so approving

review: Approve
Revision history for this message
Tim Cole (tcole) wrote :

Much better. I'd suggest calling the one function revert_watches rather than restore_watches (the latter implying that watches are being put back rather than removed).

review: Approve
443. By Facundo Batista

Renamed func

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches