Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ngie-eign opened this issue Mar 13, 2023 · 1 comment

Comments

@ngie-eign
Copy link

pyopenssl/tests/test_ssl.py

Lines 2390 to 2407 in cac7478

@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

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 ngie-eign changed the title test_ssl:TestConnection.test_connect_ex test_ssl:TestConnection.test_connect_ex fails reliably on FreeBSD 13.1-RELEASE-p1 Mar 13, 2023
@ngie-eign ngie-eign changed the title test_ssl:TestConnection.test_connect_ex fails reliably on FreeBSD 13.1-RELEASE-p1 test_ssl:TestConnection.test_connect_ex succeeds unexpectedly on FreeBSD 13.1-RELEASE-p3 Mar 13, 2023
@mtelka
Copy link

mtelka commented Jun 25, 2023

OpenIndiana (an illumos distro) is affected too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants