-
Notifications
You must be signed in to change notification settings - Fork 194
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
Potentially broken _AbstractTransport.__repr__ #361
Comments
Thank you @blueyed for your bug report. Unfortunately, I cannot understand what break in |
I have a similar problem. I don't yet understand why the socket is getting disconnected, but when it does the transport Line 119 in 86129b6
Because the socket is no currently connected, The One possible fix would be: try:
dst = f'{self.sock.getpeername()[0]}:{self.sock.getpeername()[1]}'
except (socket.error) as e:
dst = f'ERROR: {e}' |
I would be happy to review a PR with this fix and enough unit tests |
If AbstractTransport's self.sock is disconnected, then self.sock.getpeername() will raise an error in __repr__, which shows up in backtraces for other upstream errors. Fix this by catching socket.error in __repr__ and putting the error info in to the returned repr string. Fixes celery#361
I just submitted a PR (#431). It passed unit tests on cpython but I don't have pypi installed so that was skipped by
I've not run Edit: looks like the github jobs also fail the integration test, albeit with a slightly different error message |
If AbstractTransport's self.sock is disconnected, then self.sock.getpeername() will raise an error in __repr__, which shows up in backtraces for other upstream errors. Fix this by catching socket.error in __repr__ and putting the error info in to the returned repr string. Fixes celery#361
If AbstractTransport's self.sock is disconnected, then self.sock.getpeername() will raise an error in __repr__, which shows up in backtraces for other upstream errors. Fix this by catching socket.error in __repr__ and putting the error info in to the returned repr string. Fixes #361
_AbstractTransport.__repr__
(orConnection.__repr__
) might crash.In a report/issue from/in Sentry
self
was reported as "broken repr" inpy-amqp/amqp/transport.py
Line 352 in 7300741
_AbstractTransport.__repr__
:py-amqp/amqp/transport.py
Lines 100 to 106 in 7300741
Connection.__repr__
:py-amqp/amqp/connection.py
Lines 281 to 287 in 7300741
The full traceback:
I have not investigated why that is yet, but figured reporting it already is worth it, since having a proper (non-crashing) repr is more helpful during debugging/investigating issues, of course.
amqp 5.0.6 (but the code is the same in master)
sentry-sdk 1.1.0
The text was updated successfully, but these errors were encountered: