diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2018-07-24 14:12:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-24 14:12:12 +0100 |
commit | 81946db9cf4cd8c96d68edad9bdacba7c235ca70 (patch) | |
tree | 6c6c2ad3049edf9ac55a77f1475baefbaebf579d | |
parent | Merge pull request #3586 from matrix-org/rav/optimise_resolve_state_groups (diff) | |
parent | changelog (diff) | |
download | synapse-81946db9cf4cd8c96d68edad9bdacba7c235ca70.tar.xz |
Merge pull request #3587 from matrix-org/rav/better_exception_logging
Improve logging for exceptions when handling PDUs
-rw-r--r-- | changelog.d/3587.misc | 1 | ||||
-rw-r--r-- | synapse/federation/federation_server.py | 11 |
2 files changed, 9 insertions, 3 deletions
diff --git a/changelog.d/3587.misc b/changelog.d/3587.misc new file mode 100644 index 0000000000..75a3479910 --- /dev/null +++ b/changelog.d/3587.misc @@ -0,0 +1 @@ +Improve logging for exceptions when handling PDUs \ No newline at end of file diff --git a/synapse/federation/federation_server.py b/synapse/federation/federation_server.py index 48f26db67c..e501251b6e 100644 --- a/synapse/federation/federation_server.py +++ b/synapse/federation/federation_server.py @@ -24,6 +24,7 @@ from prometheus_client import Counter 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 @@ -186,8 +187,12 @@ class FederationServer(FederationBase): 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(), @@ -203,8 +208,8 @@ class FederationServer(FederationBase): ) 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, |