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

Exception on program exit using SSL in python >= 3.4 ? #57

Open
petersilva opened this issue Feb 1, 2017 · 1 comment
Open

Exception on program exit using SSL in python >= 3.4 ? #57

petersilva opened this issue Feb 1, 2017 · 1 comment

Comments

@petersilva
Copy link

I think this will hit anyone connecting to an SSL broker on python > 3.4, but not sure. If someone else can reproduce it, that would be good.

I connect to a broker, and without SSL, the code works fine. When SSL is on, it still works fine, but as part of sys.exit() processing it prints out this:

Exception ignored in: <bound method _AbstractTransport.__del__ of <amqplib.client_0_8.transport.SSLTransport object at 0x7f93e0834dd8>>
Traceback (most recent call last):
File "/home/peter/.local/lib/python3.5/site-packages/amqplib-1.0.2-py3.5.egg/amqplib/client_0_8/transport.py", line 97, in __del__
File "/home/peter/.local/lib/python3.5/site-packages/amqplib-1.0.2-py3.5.egg/amqplib/client_0_8/transport.py", line 136, in close
File "/home/peter/.local/lib/python3.5/site-packages/amqplib-1.0.2-py3.5.egg/amqplib/client_0_8/transport.py", line 208, in _shutdown_transport
File "/usr/lib/python3.5/ssl.py", line 971, in unwrap
s = self._sslobj.unwrap()
File "/usr/lib/python3.5/ssl.py", line 642, in unwrap
return self._sslobj.shutdown()
ssl.SSLError: Underlying socket connection gone (_ssl.c:2020)
b

Nothing in the application seems responsible for this. It just always happens in sys.exit()

I found two methods of suppressing the error:
in amqplib/client_0_8/transport.py

I can either comment out the __del__() method, or
put a try/except: pass clause in close()

I read a bit, and it seems that in python >= 3.4 it has gotten more consistent about calling __del__()
( PEP442 ) but that is just a guess.

I can offer a patch with either fix if one is blessed. But I don't know whether either approach is good. Any suggestions?

@petersilva
Copy link
Author

It has nothing to do with the PEP442. shows up on older pythons as well.

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

No branches or pull requests

1 participant