pyopenssl icon indicating copy to clipboard operation
pyopenssl copied to clipboard

test_ssl:TestConnection.test_connect_ex succeeds unexpectedly on FreeBSD 13.1-RELEASE-p3

Open ngie-eign opened this issue 2 years ago • 1 comments

https://github.com/pyca/pyopenssl/blob/cac747892be07a06d0315917fc72cfd06d10e471/tests/test_ssl.py#L2390-L2407

This test fails fairly reliably on my physical host. If I space out the commands so the socket is fully setup, then call connect_ex, the test succeeded. Some additional synchronization is likely required to make the test pass/fail reliably.

Configuration

  • FreeBSD 13.1-RELEASE-p3
  • pytest 7.2.0
  • python 3.9.16
$ openssl version
OpenSSL 1.1.1o-freebsd  3 May 2022
$ pkg query %dn-%dv py39-openssl | sort -u
py39-cryptography-39.0.2
py39-setuptools-63.1.0
py39-six-1.16.0
python39-3.9.16

Example failure

self = <tests.test_ssl.TestConnection object at 0x804971610>

    @pytest.mark.skipif(
        platform == "darwin",
        reason="connect_ex sometimes causes a kernel panic on OS X 10.6.4",
    )
    def test_connect_ex(self):
        """
        If there is a connection error, `Connection.connect_ex` returns the
        errno instead of raising an exception.
        """
        port = socket_any_family()
        port.bind(("", 0))
        port.listen(3)
    
        clientSSL = Connection(Context(SSLv23_METHOD), socket(port.family))
        clientSSL.setblocking(False)
        result = clientSSL.connect_ex(port.getsockname())
        expected = (EINPROGRESS, EWOULDBLOCK)
>       assert result in expected
E       assert 0 in (36, 35)

ngie-eign avatar Mar 13 '23 08:03 ngie-eign

OpenIndiana (an illumos distro) is affected too.

mtelka avatar Jun 25 '23 06:06 mtelka