Unsuccessful TLS handshake leaking connections
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- networking
Research direction
Run the attached ssl_leak.py example with netcat on 127.0.0.1:9000 to reproduce the differing HTTP and HTTPS behavior. Then inspect IOStream.start_tls and iostream_tls_leak_fix.diff.txt; done means an incomplete handshake no longer leaves the underlying connection open, with the timeout behavior resolved.
Written by the indexing model from the issue text.
Description
Tornado's IOStream.start_tls leaks connections when the handshake starts but does not complete. The AsyncHTTPClient returns "HTTP 599: Timeout while connecting", but the underlying connection is not closed.
This can be reproduced quite easily: start a netcat to listen on 127.0.0.1:9000 and run the attached example with "ssl_leak.py http" or "ssl_leak.py https" to observe different behaviors. HTTP closes the connection (and netcat exits), while HTTPS keeps the connection up even after the request errors.
I've observed this behavior with
OpenSSL: OpenSSL 1.1.0f 25 May 2017
Python: 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170124]
Tornado: 4.5.3
and
OpenSSL: OpenSSL 1.1.1d 10 Sep 2019
Python: 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.3.0]
Tornado: 6.0.3
I've confirmed this is an issue in start_tls with a "fix", but this fix includes a timeout, which is currently hardcoded. This timeout value might need to be somehow passed into start_tls, but the start_tls is hidden quite deep.
- Dominant language
- Python
- Stars
- 22.2k
- Forks
- 5.6k
- Avg merge
- 3h 42m
- Merged PRs (30d)
- 16
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tornadoweb/tornado
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
tornadoweb/tornado#3701 · 1 comment ·
-
httpserver
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
tornadoweb/tornado#1050 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
tornadoweb/tornado#3728 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 64/100
tornadoweb/tornado#3651 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 50/100
tornadoweb/tornado#3616 · 2 comments ·
All issues in tornadoweb/tornado
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100