Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Improve logging for exceptions when handling PDUs #3587

Merged
merged 2 commits into from
Jul 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3587.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve logging for exceptions when handling PDUs
11 changes: 8 additions & 3 deletions synapse/federation/federation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

from twisted.internet import defer
from twisted.internet.abstract import isIPAddress
from twisted.python import failure

from synapse.api.constants import EventTypes
from synapse.api.errors import AuthError, FederationError, NotFoundError, SynapseError
Expand Down Expand Up @@ -186,8 +187,12 @@ def process_pdus_for_room(room_id):
logger.warn("Error handling PDU %s: %s", event_id, e)
pdu_results[event_id] = {"error": str(e)}
except Exception as e:
f = failure.Failure()
pdu_results[event_id] = {"error": str(e)}
logger.exception("Failed to handle PDU %s", event_id)
logger.error(
"Failed to handle PDU %s: %s",
event_id, f.getTraceback().rstrip(),
)

yield async.concurrently_execute(
process_pdus_for_room, pdus_by_room.keys(),
Expand All @@ -203,8 +208,8 @@ def process_pdus_for_room(room_id):
)

pdu_failures = getattr(transaction, "pdu_failures", [])
for failure in pdu_failures:
logger.info("Got failure %r", failure)
for fail in pdu_failures:
logger.info("Got failure %r", fail)

response = {
"pdus": pdu_results,
Expand Down