anonymousland-synapse/synapse
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
..
_scripts Remove obsolete __future__ imports (#8337) 2020-09-17 08:37:01 -04:00
api Don't push if an user account has expired (#8353) 2020-09-23 16:06:28 +01:00
app Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
appservice Add type annotations to SimpleHttpClient (#8372) 2020-09-24 15:47:20 +01:00
config Allow existing users to login via OpenID Connect. (#8345) 2020-09-25 07:01:45 -04:00
crypto Fix occasional "Re-starting finished log context" from keyring (#8398) 2020-09-25 12:29:54 +01:00
events Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
federation Synapse 1.20.0rc5 (2020-09-18) 2020-09-18 11:17:58 -04:00
groups Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
handlers Fix handling of connection timeouts in outgoing http requests (#8400) 2020-09-29 10:29:21 +01:00
http Fix handling of connection timeouts in outgoing http requests (#8400) 2020-09-29 10:29:21 +01:00
logging Create a mechanism for marking tests "logcontext clean" (#8399) 2020-09-28 17:58:33 +01:00
metrics Use slots in attrs classes where possible (#8296) 2020-09-14 12:50:06 -04:00
module_api Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
push Don't push if an user account has expired (#8353) 2020-09-23 16:06:28 +01:00
replication Fix MultiWriteIdGenerator's handling of restarts. (#8374) 2020-09-24 16:53:51 +01:00
res/templates Escape the error description on the sso_error template. (#8405) 2020-09-25 11:05:54 -04:00
rest Add type annotations to SimpleHttpClient (#8372) 2020-09-24 15:47:20 +01:00
server_notices Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
spam_checker_api Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
state Improve logging of state resolution (#8371) 2020-09-23 16:42:44 +01:00
static Clean-up the fallback login code. (#7657) 2020-06-10 09:50:39 -04:00
storage Add checks for postgres sequence consistency (#8402) 2020-09-28 18:00:30 +01:00
streams Clean up types for PaginationConfig (#8250) 2020-09-08 15:00:17 +01:00
util Fix handling of connection timeouts in outgoing http requests (#8400) 2020-09-29 10:29:21 +01:00
__init__.py 1.20.1 2020-09-24 16:25:33 +01:00
event_auth.py Convert events worker database to async/await. (#8071) 2020-08-18 16:20:49 -04:00
notifier.py Add EventStreamPosition type (#8388) 2020-09-24 13:24:17 +01:00
python_dependencies.py Do not check lint/test dependencies at runtime. (#8377) 2020-09-23 11:45:37 +01:00
secrets.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
server.py Fix ratelimiting for federation /send requests. (#8342) 2020-09-18 10:49:29 +01:00
types.py Add EventStreamPosition type (#8388) 2020-09-24 13:24:17 +01:00
visibility.py Convert groups and visibility code to async / await. (#7951) 2020-07-27 12:32:08 -04:00