Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
723b1974
Unverified
Commit
723b1974
authored
4 years ago
by
Patrick Cloke
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Handle bad JSON data being returned from the federation API. (#9070)
parent
0f8945e1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changelog.d/9070.bugfix
+1
-0
1 addition, 0 deletions
changelog.d/9070.bugfix
synapse/http/matrixfederationclient.py
+10
-0
10 additions, 0 deletions
synapse/http/matrixfederationclient.py
tests/http/test_fedclient.py
+1
-1
1 addition, 1 deletion
tests/http/test_fedclient.py
with
12 additions
and
1 deletion
changelog.d/9070.bugfix
0 → 100644
+
1
−
0
View file @
723b1974
Fix `JSONDecodeError` spamming the logs when sending transactions to remote servers.
This diff is collapsed.
Click to expand it.
synapse/http/matrixfederationclient.py
+
10
−
0
View file @
723b1974
...
@@ -174,6 +174,16 @@ async def _handle_json_response(
...
@@ -174,6 +174,16 @@ async def _handle_json_response(
d
=
timeout_deferred
(
d
,
timeout
=
timeout_sec
,
reactor
=
reactor
)
d
=
timeout_deferred
(
d
,
timeout
=
timeout_sec
,
reactor
=
reactor
)
body
=
await
make_deferred_yieldable
(
d
)
body
=
await
make_deferred_yieldable
(
d
)
except
ValueError
as
e
:
# The JSON content was invalid.
logger
.
warning
(
"
{%s} [%s] Failed to parse JSON response - %s %s
"
,
request
.
txn_id
,
request
.
destination
,
request
.
method
,
request
.
uri
.
decode
(
"
ascii
"
),
)
raise
RequestSendFailed
(
e
,
can_retry
=
False
)
from
e
except
defer
.
TimeoutError
as
e
:
except
defer
.
TimeoutError
as
e
:
logger
.
warning
(
logger
.
warning
(
"
{%s} [%s] Timed out reading response - %s %s
"
,
"
{%s} [%s] Timed out reading response - %s %s
"
,
...
...
This diff is collapsed.
Click to expand it.
tests/http/test_fedclient.py
+
1
−
1
View file @
723b1974
...
@@ -560,4 +560,4 @@ class FederationClientTests(HomeserverTestCase):
...
@@ -560,4 +560,4 @@ class FederationClientTests(HomeserverTestCase):
self
.
pump
()
self
.
pump
()
f
=
self
.
failureResultOf
(
test_d
)
f
=
self
.
failureResultOf
(
test_d
)
self
.
assertIsInstance
(
f
.
value
,
ValueError
)
self
.
assertIsInstance
(
f
.
value
,
RequestSendFailed
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment