forked-synapse/synapse/util
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
..
caches Use slots in attrs classes where possible (#8296) 2020-09-14 12:50:06 -04:00
__init__.py Use slots in attrs classes where possible (#8296) 2020-09-14 12:50:06 -04:00
async_helpers.py Fix handling of connection timeouts in outgoing http requests (#8400) 2020-09-29 10:29:21 +01:00
daemonize.py Stop the parent process flushing the logs on exit (#8012) 2020-08-05 09:35:17 +01:00
distributor.py Remove some unused distributor signals (#8216) 2020-09-09 12:22:00 -04:00
file_consumer.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
frozenutils.py Directly import json from the standard library. (#8259) 2020-09-08 07:33:48 -04:00
hash.py Use the v2 Identity Service API for lookups (MSC2134 + MSC2140) (#5976) 2019-09-11 16:02:42 +01:00
httpresourcetree.py Replace instance variations of homeserver with correct case/spacing 2019-11-12 13:08:12 +00:00
iterutils.py Log saml assertions rather than the whole response 2020-01-16 22:26:34 +00:00
jsonobject.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
logcontext.py Improve the backwards compatibility re-exports of synapse.logging.context (#5617) 2019-07-05 02:32:02 +10:00
logformatter.py Improve the backwards compatibility re-exports of synapse.logging.context (#5617) 2019-07-05 02:32:02 +10:00
manhole.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
metrics.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
module_loader.py Handle config not being set for synapse plugin modules 2020-01-12 21:34:36 +00:00
msisdn.py Run Black. (#5482) 2019-06-20 19:32:02 +10:00
patch_inline_callbacks.py Remove obsolete __future__ imports (#8337) 2020-09-17 08:37:01 -04:00
ratelimitutils.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
retryutils.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
rlimit.py Remove usage of deprecated logger.warn method from codebase (#6271) 2019-10-31 10:23:24 +00:00
stringutils.py Remove : from allowed client_secret chars (#8101) 2020-08-18 14:14:27 +01:00
threepids.py Fix inconsistent handling of upper and lower cases of email addresses. (#7021) 2020-07-03 14:03:13 +01:00
versionstring.py Handle FileNotFound error in checking git repository version (#6284) 2019-10-30 11:00:15 +00:00
wheel_timer.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00