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

Commit

Permalink
Merge pull request #3587 from matrix-org/rav/better_exception_logging
Browse files Browse the repository at this point in the history
Improve logging for exceptions when handling PDUs
  • Loading branch information
richvdh authored Jul 24, 2018
2 parents a321f78 + d8709df commit 81946db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
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

0 comments on commit 81946db

Please sign in to comment.