-
Notifications
You must be signed in to change notification settings - Fork 42
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
Standardize connection errors #823
Conversation
This is blocked until #820 is fixed. |
88764b6
to
16b30f1
Compare
16b30f1
to
94b6bb6
Compare
OK so I started looking at this but didn't finish, manual testing thus far: ❌ #811, server connection error - I did not see the error go away after reconnecting my staging server. this might be due to something wrong in my local environment, but didn't get further here. @creviera can you reconfirm in qubes that all looks good? then I'll (or anyone else who beats me to it) take a spin tomorrow |
I'm also having trouble testing the server connection error with these steps (unpausing vms is finicky), so here are alternative steps to test server connect errors while I simultaneously look into why unpausing doesn't bring the server back up (why we can't even get to the journalist interface): for #811:
--- a/securedrop_client/api_jobs/uploads.py
+++ b/securedrop_client/api_jobs/uploads.py
@@ -94,6 +94,11 @@ class SendReplyJob(ApiJob):
uuid=self.reply_uuid, e=e))
def _make_call(self, encrypted_reply: str, api_client: API) -> sdclientapi.Reply:
+ import random
+ if random.choice([0, 1]):
+ self.remaining_attempts = 0;
+ raise ServerConnectionError()
+
sdk_source = sdclientapi.Source(uuid=self.source_uuid)
for #798:
--- a/securedrop_client/sync.py
+++ b/securedrop_client/sync.py
@@ -116,6 +116,12 @@ class ApiSyncBackgroundTask(QObject):
self.sync_started.emit()
session = self.session_maker()
self.job.remaining_attempts = 2
+
+ import random
+ if random.choice([0, 1]):
+ self.job.failure_signal.emit(ServerConnectionError())
+ return
+
self.job._do_call_api(self.api_client, session)
except ApiInaccessibleError as e:
self.job.failure_signal.emit(e) # the job's failure signal is not emitted in base
|
i'm going to squash some of these commits |
2d2278e
to
d848942
Compare
d848942
to
ab7465f
Compare
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.
Thanks @creviera functional testing and visual review looks good to me. Tested in Qubes with a physical instance (I used sudo service apache2 stop/start
to simulate a ServerConnectionError
, and stopping Tor to simulate a RequestTimeoutError
), and also using the diff you've provided (including #823 (comment)
Test Plan
for #811:
server connect error
- run the client against prod server
- disable apache2
- ✔️ send a reply and see "The SecureDrop server cannot be reached. Trying to reconnect..." without a retry link
- ✔️ send another reply and see the same message without a retry link
- enable apache2
- ✔️ see the error message go away. The message is not sent due to Replies get stuck in pending state #825 . restarting the client, the messages appear as sent
Also reproduced this with the diff you've provided in #823 (comment)
request timeout error
- apply diff so a reply will timeout:
- run the client
- ✔️ send a reply and see "The SecureDrop server cannot be reached. Trying to reconnect..." without a retry link
- ✔️ when then next sync succeeds, see the error message go away (note: the error message will show up again because the reply with a 0.01s timeout will try again and always timeout)
for #798:
server connect error
- run the client against prod server
- apache2 stop
- ✔️ do not send any replies and wait for the next sync (the sync should fail) and see "The SecureDrop server cannot be reached. Trying to reconnect..."
- apache2 start
- ✔️ see the error message go away
request timeout error
- apply this diff so a sync will timeout:
- run the client
- ✔️ the first sync should fail and you should see "The SecureDrop server cannot be reached. Trying to reconnect..."
Description
Resolves #798
Resolves #811
Test Plan
for #811:
server connect error
request timeout error
for #798:
server connect error
request timeout error
Checklist
If these changes modify code paths involving cryptography, the opening of files in VMs or network (via the RPC service) traffic, Qubes testing in the staging environment is required. For fine tuning of the graphical user interface, testing in any environment in Qubes is required. Please check as applicable: