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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix possible crash when sync occurs right after a workspace reencryption. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,7 +104,7 @@ async def test_init_with_backend_offline(event_bus, alice): | |
|
||
@pytest.mark.trio | ||
@pytest.mark.parametrize("during_bootstrap", (True, False)) | ||
async def test_monitor_crash(running_backend, event_bus, alice, during_bootstrap): | ||
async def test_monitor_crash(caplog, running_backend, event_bus, alice, during_bootstrap): | ||
async def _bad_monitor(*, task_status=trio.TASK_STATUS_IGNORED): | ||
if during_bootstrap: | ||
raise RuntimeError("D'oh !") | ||
|
@@ -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]" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test seems a bit sensitive with the arbitrary number of spaces There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes totally agree, I though about improving |
||
) | ||
|
||
# Test command not possible | ||
with pytest.raises(BackendNotAvailable) as exc: | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.