This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix handling of connection timeouts in outgoing http requests #8400
Merged
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a3a67e4
improve docstrings in ProxyAgent
richvdh 13d5a77
Remove `on_timeout_cancel` from `timeout_deferred`
richvdh d0b7d07
Fix handling of connection timeouts in outgoing http requests
richvdh 56bdab8
Fix incorrect handling of timeouts reading federation responses
richvdh 65b1fe4
Fix inconsistent handling of `timeout` param between methods
richvdh 87d52ac
newsfile
richvdh 6362ede
Update synapse/util/async_helpers.py
richvdh 1018dba
update docstrings
richvdh 204fcdf
Catch more timeout errors
erikjohnston 16ff46e
Add tests for SimpleHttpClient
erikjohnston File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fix incorrect handling of timeouts on outgoing HTTP requests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -171,7 +171,7 @@ async def _handle_json_response( | |
| d = timeout_deferred(d, timeout=timeout_sec, reactor=reactor) | ||
|
|
||
| body = await make_deferred_yieldable(d) | ||
| except TimeoutError as e: | ||
| except defer.TimeoutError as e: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A bit confusing that they chose the same name as a built-in. Edit: Ah, I see you noted this below! 🤦 |
||
| logger.warning( | ||
| "{%s} [%s] Timed out reading response - %s %s", | ||
| request.txn_id, | ||
|
|
@@ -706,8 +706,13 @@ async def put_json( | |
| timeout=timeout, | ||
| ) | ||
|
|
||
| if timeout is not None: | ||
| _sec_timeout = timeout / 1000 | ||
| else: | ||
| _sec_timeout = self.default_timeout | ||
|
|
||
| body = await _handle_json_response( | ||
| self.reactor, self.default_timeout, request, response, start_ms | ||
| self.reactor, _sec_timeout, request, response, start_ms | ||
clokep marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ) | ||
|
|
||
| return body | ||
|
|
@@ -842,8 +847,13 @@ async def get_json( | |
| timeout=timeout, | ||
| ) | ||
|
|
||
| if timeout is not None: | ||
| _sec_timeout = timeout / 1000 | ||
| else: | ||
| _sec_timeout = self.default_timeout | ||
|
|
||
| body = await _handle_json_response( | ||
| self.reactor, self.default_timeout, request, response, start_ms | ||
| self.reactor, _sec_timeout, request, response, start_ms | ||
| ) | ||
|
|
||
| return body | ||
|
|
@@ -902,8 +912,13 @@ async def delete_json( | |
| ignore_backoff=ignore_backoff, | ||
| ) | ||
|
|
||
| if timeout is not None: | ||
| _sec_timeout = timeout / 1000 | ||
| else: | ||
| _sec_timeout = self.default_timeout | ||
|
|
||
| body = await _handle_json_response( | ||
| self.reactor, self.default_timeout, request, response, start_ms | ||
| self.reactor, _sec_timeout, request, response, start_ms | ||
| ) | ||
| return body | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.