Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't log stack trace when handling TemporaryNotificationDispatchException exception #229

Open
chagai95 opened this issue Jun 10, 2021 · 2 comments

Comments

@chagai95
Copy link

Describe the bug
Not sure but saw something in the debug logs

2021-06-09 14:12:27,111 [1] INFO  sygnal.access Handled request: "127.0.0.1" - - [09/Jun/2021:12:12:27 +0000] "POST /_matrix/push/v1/notify HTTP/1.0" 200 16 "-" "Synapse/1.27.0"
2021-06-09 14:14:51,633 [1] DEBUG sygnal.http [132ef873-b946-4892-8c14-3260ae636326] Sending push to pushkin com.aarenet.anConnect.ios.app.ios.prod for app ID com.aarenet.anConnect.ios.app.ios.prod
2021-06-09 14:14:51,634 [1] INFO  sygnal.apnspushkin [132ef873-b946-4892-8c14-3260ae636326] Sending as APNs-ID 202656f0-f97e-4782-8911-9c26dfce882b
2021-06-09 14:14:51,634 [1] DEBUG aioapns Notification 202656f0-f97e-4782-8911-9c26dfce882b: waiting for connection
2021-06-09 14:14:51,636 [1] DEBUG sygnal.http [3a3949ad-d628-44c8-abff-c812aa08b910] Sending push to pushkin com.aarenet.anconnect.android for app ID com.aarenet.anconnect.android
2021-06-09 14:14:51,638 [1] INFO  sygnal.gcmpushkin [3a3949ad-d628-44c8-abff-c812aa08b910] Sending (attempt 0) => ['fG3HsmCoQGCt4nV37ce68K:APA91bF5ST_wz9tBHmgC8VNmjLz52rkOSe-3JdkNoeFiaj_ge7hD0Fr6Imcl-mRHihviqohmhg9q4IoO_WSy0wplMxCYRAVbFD7Wi2UVvOu8YFGmYwruN-TAldH9Qx0f2EN5WgBcpacA']
2021-06-09 14:14:51,638 [1] DEBUG sygnal.helper.proxy.proxyagent_twisted Requesting b'https://fcm.googleapis.com/fcm/send' via <HostnameEndpoint fcm.googleapis.com:443>
2021-06-09 14:14:51,644 [1] WARNING sygnal.gcmpushkin [3a3949ad-d628-44c8-abff-c812aa08b910] Temporary failure, will retry in 10 seconds
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/sygnal/gcmpushkin.py", line 193, in _perform_http_request
    bodyProducer=body_producer,
twisted.web._newclient.ResponseNeverReceived: [<twisted.python.failure.Failure twisted.internet.error.ConnectionLost: Connection to the other side was lost in a non-clean fashion: Connection lost.>]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/sygnal/gcmpushkin.py", line 384, in _dispatch_notification_unlimited
    n, log, body, headers, mapped_pushkeys, span
  File "/usr/local/lib/python3.7/site-packages/sygnal/gcmpushkin.py", line 209, in _request_dispatch
    response, response_text = await self._perform_http_request(body, headers)
  File "/usr/local/lib/python3.7/site-packages/sygnal/gcmpushkin.py", line 199, in _perform_http_request
    ) from exception
sygnal.exceptions.TemporaryNotificationDispatchException: GCM request failure
2021-06-09 14:14:51,745 [1] INFO  twisted Stopping factory _HTTP11ClientFactory(<function HTTPConnectionPool._newConnection.<locals>.quiescentCallback at 0x7f99c4350f80>, <twisted.internet.endpoints._WrapperEndpoint object at 0x7f99c42b36d0>)

@erikjohnston
Copy link
Member

erikjohnston commented Jul 23, 2021

That looks to be because the request timed out. Maybe the internet or Google had a blip or something 🤷

I'm not sure why we log the stack trace though, we should just log the exception message and not the stack trace.

@erikjohnston erikjohnston changed the title Temporary failure, will retry in 10 seconds - what might the reason be? Don't log stack trace when handling TemporaryNotificationDispatchException exception Jul 23, 2021
@erikjohnston
Copy link
Member

I think this is just a case of removing exc_info=True here:

sygnal/sygnal/gcmpushkin.py

Lines 398 to 402 in 214497a

log.warning(
"Temporary failure, will retry in %d seconds",
retry_delay,
exc_info=True,
)

And also adding exc to the log line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants