MatrixSynapse/synapse/handlers
Richard van der Hoff 1c262431f9
Fix handling of connection timeouts in outgoing http requests (#8400)
* Remove `on_timeout_cancel` from `timeout_deferred`

The `on_timeout_cancel` param to `timeout_deferred` wasn't always called on a
timeout (in particular if the canceller raised an exception), so it was
unreliable. It was also only used in one place, and to be honest it's easier to
do what it does a different way.

* Fix handling of connection timeouts in outgoing http requests

Turns out that if we get a timeout during connection, then a different
exception is raised, which wasn't always handled correctly.

To fix it, catch the exception in SimpleHttpClient and turn it into a
RequestTimedOutError (which is already a documented exception).

Also add a description to RequestTimedOutError so that we can see which stage
it failed at.

* Fix incorrect handling of timeouts reading federation responses

This was trapping the wrong sort of TimeoutError, so was never being hit.

The effect was relatively minor, but we should fix this so that it does the
expected thing.

* Fix inconsistent handling of `timeout` param between methods

`get_json`, `put_json` and `delete_json` were applying a different timeout to
the response body to `post_json`; bring them in line and test.

Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
Co-authored-by: Erik Johnston <erik@matrix.org>
2020-09-29 10:29:21 +01:00
..
ui_auth Be stricter about JSON that is accepted by Synapse (#8106) 2020-08-19 07:26:03 -04:00
__init__.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
_base.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
account_data.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
account_validity.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
acme.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
acme_issuing_service.py Use slots in attrs classes where possible (#8296) 2020-09-14 12:50:06 -04:00
admin.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
appservice.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
auth.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
cas_handler.py Allow denying or shadow banning registrations via the spam checker (#8034) 2020-08-20 15:42:58 -04:00
deactivate_account.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
device.py Create function to check for long names in devices (#8364) 2020-09-22 11:42:55 +01:00
devicemessage.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
directory.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
e2e_keys.py Use slots in attrs classes where possible (#8296) 2020-09-14 12:50:06 -04:00
e2e_room_keys.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
events.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
federation.py A pair of tiny cleanups in the federation request code. (#8401) 2020-09-28 13:15:00 +01:00
groups_local.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
identity.py Fix handling of connection timeouts in outgoing http requests (#8400) 2020-09-29 10:29:21 +01:00
initial_sync.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
message.py Add EventStreamPosition type (#8388) 2020-09-24 13:24:17 +01:00
oidc_handler.py Allow existing users to login via OpenID Connect. (#8345) 2020-09-25 07:01:45 -04:00
pagination.py Fix a bad merge from release-v1.20.0. (#8354) 2020-09-18 12:54:04 -04:00
password_policy.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
presence.py Clean up types for PaginationConfig (#8250) 2020-09-08 15:00:17 +01:00
profile.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
read_marker.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
receipts.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
register.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
room.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
room_list.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
room_member.py Switch metaclass initialization to python 3-compatible syntax (#8326) 2020-09-16 15:15:55 -04:00
room_member_worker.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
saml_handler.py Use slots in attrs classes where possible (#8296) 2020-09-14 12:50:06 -04:00
search.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
set_password.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
state_deltas.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
stats.py Prevent join->join membership transitions changing member count (#7977) 2020-08-03 21:54:24 +01:00
sync.py Add EventStreamPosition type (#8388) 2020-09-24 13:24:17 +01:00
typing.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
user_directory.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00