pyca / pyca/pyopenssl

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

Open
#1,192 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
944
Forks
440
Avg merge
1d 6h
Merged PRs (30d)
6

Description

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)

Contributor guide

Open the contributing guide

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.

Research direction

Start with tests/test_ssl.py lines 2390-2407 and reproduce test_connect_ex on FreeBSD 13.1 with the reported Python, pytest, and OpenSSL versions. Investigate synchronization around socket setup and connect_ex, then run the test to confirm it reliably returns the expected connection-in-progress error or otherwise behaves consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.