pyopenssl icon indicating copy to clipboard operation
pyopenssl copied to clipboard

Empty list of errors from SSL.bio_read

Open etam opened this issue 7 years ago • 1 comments

So this happened (this is a tail of a stacktrace, you can see it full at https://github.com/golemfactory/golem/issues/2834):

  File "/Users/ederenn/golem/venv/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1672, in bio_read
    self._handle_bio_errors(self._from_ssl, result)
  File "/Users/ederenn/golem/venv/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1653, in _handle_bio_errors
    _raise_current_error()
  File "/Users/ederenn/golem/venv/lib/python3.6/site-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue
    raise exception_type(errors)
OpenSSL.SSL.Error: []

I suspect it might be caused by this in SSL.bio_read:

        if result <= 0:
            self._handle_bio_errors(self._from_ssl, result)

According to https://www.openssl.org/docs/manmaster/man3/BIO_read.html :

A 0 or -1 return is not necessarily an indication of an error. In particular when the source/sink is non-blocking or of a certain type it may merely be an indication that no data is currently available and that the application should retry the operation later.

etam avatar Jun 05 '18 10:06 etam

Hmm, that is indeed an issue. Can the socket in a Connection be queried for blocking/non-blocking status? Would that even be safe here?

reaperhulk avatar Jun 06 '18 09:06 reaperhulk