forked-synapse/synapse/http
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
..
federation Use slots in attrs classes where possible (#8296) 2020-09-14 12:50:06 -04:00
__init__.py Fix handling of connection timeouts in outgoing http requests (#8400) 2020-09-29 10:29:21 +01:00
additional_resource.py Merge different Resource implementation classes (#7732) 2020-07-03 19:02:19 +01:00
client.py Fix handling of connection timeouts in outgoing http requests (#8400) 2020-09-29 10:29:21 +01:00
connectproxyclient.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
endpoint.py Run Black. (#5482) 2019-06-20 19:32:02 +10:00
matrixfederationclient.py Fix handling of connection timeouts in outgoing http requests (#8400) 2020-09-29 10:29:21 +01:00
proxyagent.py Fix handling of connection timeouts in outgoing http requests (#8400) 2020-09-29 10:29:21 +01:00
request_metrics.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
server.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
servlet.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
site.py Don't log OPTIONS request at INFO (#8049) 2020-08-07 14:53:05 +01:00