MagicStack / MagicStack/uvloop

SSL connection error while debug is enabled

Open
#449 1 comment 0 reactions 1 assignee View on GitHub

@fantix is already working on this.

Since Oct 27, 2021.

Dominant language
Cython
Stars
11.9k
Forks
616
PR merge metrics
No merged PRs in 30d

Description

* **uvloop version**: 0.15.2
* **Python version**: 3.7.3
* **Platform**: Debian GNU/Linux 10
* **Can you reproduce the bug with `PYTHONASYNCIODEBUG` in env?**: yes
* **Does uvloop behave differently from vanilla asyncio? How?**: yes, error in uvloop code

Sometimes when asyncio debug enabled (and connection is closed before starting SSL handshake? ) I got the error:
```
protocol:
transport:
Traceback (most recent call last):
File "uvloop/handles/stream.pyx", line 987, in uvloop.loop.__uv_stream_buffered_on_read
File "uvloop/loop.pyx", line 107, in uvloop.loop.run_in_context1
File "uvloop/sslproto.pyx", line 379, in uvloop.loop.SSLProtocol.buffer_updated
File "uvloop/sslproto.pyx", line 505, in uvloop.loop.SSLProtocol._do_handshake
File "uvloop/sslproto.pyx", line 531, in uvloop.loop.SSLProtocol._on_handshake_complete
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'
```

Looks like you should check if handshake is started before getting _handshake_start_time sslproto.pyx:
```
if self._loop.get_debug():
dt = self._loop.time() - self._handshake_start_time
aio_logger.debug("%r: SSL handshake took %.1f ms", self, dt * 1e3)
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.