Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fs bad encryption revision in sync monitor #1730

Merged
merged 3 commits into from May 27, 2021

Conversation

touilleMan
Copy link
Member

@touilleMan touilleMan commented May 12, 2021

fix #1725

@touilleMan touilleMan requested a review from vxgmichel May 12, 2021 20:22
touilleMan added a commit that referenced this pull request May 12, 2021
touilleMan added a commit that referenced this pull request May 14, 2021
@touilleMan touilleMan force-pushed the fix-FSBadEncryptionRevision-in-sync_monitor branch from 79a3615 to 9cac41d Compare May 14, 2021 19:53
@codecov
Copy link

codecov bot commented May 14, 2021

Codecov Report

Merging #1730 (4322c23) into master (83c96a6) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1730      +/-   ##
==========================================
- Coverage   87.83%   87.82%   -0.01%     
==========================================
  Files         243      243              
  Lines       23564    23564              
==========================================
- Hits        20697    20695       -2     
- Misses       2867     2869       +2     
Impacted Files Coverage Δ
parsec/core/sync_monitor.py 92.43% <100.00%> (+1.19%) ⬆️
parsec/core/messages_monitor.py 95.65% <0.00%> (-4.35%) ⬇️
parsec/core/gui/parsec_application.py 79.36% <0.00%> (-1.59%) ⬇️
parsec/core/gui/custom_widgets.py 65.91% <0.00%> (-1.35%) ⬇️
parsec/service_nursery.py 79.48% <0.00%> (-1.29%) ⬇️
parsec/core/fs/remote_loader.py 84.70% <0.00%> (-0.75%) ⬇️
parsec/core/fs/userfs/userfs.py 86.35% <0.00%> (-0.22%) ⬇️
parsec/core/gui/workspaces_widget.py 83.43% <0.00%> (-0.21%) ⬇️
parsec/core/gui/greet_user_widget.py 86.65% <0.00%> (+0.58%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 83c96a6...4322c23. Read the comment docs.

touilleMan added a commit that referenced this pull request May 14, 2021
@touilleMan touilleMan force-pushed the fix-FSBadEncryptionRevision-in-sync_monitor branch from 9cac41d to f6be853 Compare May 14, 2021 20:13
touilleMan added a commit that referenced this pull request May 14, 2021
@touilleMan touilleMan force-pushed the fix-FSBadEncryptionRevision-in-sync_monitor branch from f6be853 to e19b244 Compare May 14, 2021 21:03
@touilleMan touilleMan force-pushed the fix-FSBadEncryptionRevision-in-sync_monitor branch from e19b244 to 4322c23 Compare May 14, 2021 21:15
Copy link
Contributor

@vxgmichel vxgmichel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Just a few comments.

tests/conftest.py Show resolved Hide resolved
@@ -123,6 +123,9 @@ async def _bad_monitor(*, task_status=trio.TASK_STATUS_IGNORED):
{"status": BackendConnStatus.CRASHED, "status_exc": spy.ANY},
)
assert conn.status == BackendConnStatus.CRASHED
caplog.assert_occured(
"[exception] Unhandled exception [parsec.core.backend_connection.authenticated]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test seems a bit sensitive with the arbitrary number of spaces _______.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes totally agree, I though about improving _remove_colors to also trip the spaces, but it seems a bit complicated to do so I consider we will handle this in another PR when we will hit the issue (typically if updating structlog version breaks the tests)

tests/core/test_sync_monitor.py Show resolved Hide resolved
# Not the right time for the sync, retry later.
# `FSBadEncryptionRevision` occurs if the reencryption is quick
# enough to start and finish before we process the sharing.reencrypted
# message so we try a sync with the old encryption revision.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix seems OK, but I'm a bit worried that we can no longer tell the difference between an acceptable race condition (accessing the realm while the new encryption key hasn't been received) and bug in the reencryption logic. Is there a way to tell those appart and maybe log the latter?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, however I don't see how we could tell each other apart...
We could try to check if the local encryption revision has changed between this sync and the next one, but it feel like a great way to add more complexity (and so more bugs !) into this code.

The good thing is we send at most 1 request every MAINTENANCE_MIN_WAIT (i.e. 30s) so we are not flooding the server.

@touilleMan touilleMan merged commit 9607f33 into master May 27, 2021
@touilleMan touilleMan deleted the fix-FSBadEncryptionRevision-in-sync_monitor branch May 27, 2021 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants