classification
Title: SSL.py recursion limit crash
Type: behavior Stage: resolved
Components: SSL Versions: Python 3.6
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: christian.heimes Nosy List: Sumner Hearth, christian.heimes
Priority: normal Keywords:

Created on 2017-01-04 06:05 by Sumner Hearth, last changed 2017-01-04 12:32 by r.david.murray. This issue is now closed.

Files
File name Uploaded Description Edit
crash.py Sumner Hearth, 2017-01-04 06:05 proof of concept code
crash_simple.py Sumner Hearth, 2017-01-04 07:48
Messages (4)
msg284614 - (view) Author: Sumner Hearth (Sumner Hearth) * Date: 2017-01-04 06:05
Error in python 3.6 ssl.py:

[...]
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 737, in __init__
    self._context.verify_mode = cert_reqs
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 479, in verify_mode
    super(SSLContext, SSLContext).verify_mode.__set__(self, value)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 479, in verify_mode
    super(SSLContext, SSLContext).verify_mode.__set__(self, value)
[Repeated]

Crash is infinite recursion on super calls having to do with the verify_mode property

Crash found when creating an SSL context for eventlet with flask-socketio, unfortunately easiest way to reproduce involves installing eventlet, flask, flask-socketio, and pyopenssl. I've included the smallest working example of the crash in python 3.6, attached code works in python 3.5.

Note:
I'm attempting to create a dependency-free version of the file which exhibits the same behavior, it's tricky to unwrap all the libraries leading to the issue. See https://github.com/miguelgrinberg/Flask-SocketIO/issues/193 for original post discovering bug.
msg284617 - (view) Author: Sumner Hearth (Sumner Hearth) * Date: 2017-01-04 06:58
Recursion crash disappears in eventlet 0.17.4
msg284619 - (view) Author: Sumner Hearth (Sumner Hearth) * Date: 2017-01-04 07:48
Attached a simpler version of the code with same error using only eventlet.
msg284624 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2017-01-04 09:53
It's a bug in eventlet's monkey patch, not a bug in Python's ssl module. I've seen a similar issue with gevent's monkey patch.
History
Date User Action Args
2017-01-04 12:32:35r.david.murraysetstatus: open -> closed
type: crash -> behavior
stage: resolved
2017-01-04 09:53:39christian.heimessetresolution: third party
messages: + msg284624
2017-01-04 07:48:08Sumner Hearthsetfiles: + crash_simple.py

messages: + msg284619
2017-01-04 06:58:07Sumner Hearthsetmessages: + msg284617
2017-01-04 06:05:07Sumner Hearthcreate