Author pirate
Recipients christian.heimes, ned.deily, pirate, ronaldoussoren
Date 2017-01-21.23:37:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1485041840.84.0.00558025824464.issue29340@psf.upfronthosting.co.za>
In-reply-to
Content
I mistakenly thought this bug was a pyOpenSSL bug, so I reported it there (https://github.com/pyca/pyopenssl/issues/588), but it looks like this is actually a bug in CPython.

See the link for a nicer formatted bug report with more details.

Code to reproduce: https://gist.github.com/pirate/6649314e02384274b29e04364c9d0c16

Crash dump:
https://gist.github.com/pirate/e1485110093d2d9fc49596e6ff481777

Description:
The bug is a segmentation fault when closing several secure websockets from inside concurrent python3.6 threads: 
```pythohn
'python3.6 libssl_bug.py' terminated by signal SIGSEGV (Address boundary error)
```

It does not occur when doing it in a single thread, only when closing multiple threads at once.


```python
threads = []
for _ in range(NUM_THREADS):
    t = SocketThread('wss://echo.websocket.org/', ssl_opt={'cert_reqs': 0})
    t.start()
    threads.append(t)

sleep(4)

for t in threads:
    t.keep_running = False
    t.ws.close()  # libssl segfaults on python3.6 when closing a wss:// connection with cert_reqs=0
    t.join()

```

This is my first python bug report, so apologies if I didn't get the formatting right or if I'm missing some info.
History
Date User Action Args
2017-01-21 23:37:20piratesetrecipients: + pirate, ronaldoussoren, christian.heimes, ned.deily
2017-01-21 23:37:20piratesetmessageid: <1485041840.84.0.00558025824464.issue29340@psf.upfronthosting.co.za>
2017-01-21 23:37:20piratelinkissue29340 messages
2017-01-21 23:37:20piratecreate