This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author erlendaasland
Recipients christian.heimes, erlendaasland, pablogsal
Date 2021-05-29.21:44:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1622324695.43.0.479711462601.issue44229@roundup.psfhosted.org>
In-reply-to
Content
Here's the output when with test.support.verbose = True:

test_ssl: testing with 'OpenSSL 1.1.1k  25 Mar 2021' (1, 1, 1, 11, 15)                                                 
          under Mac ('11.3.1', ('', '', ''), 'x86_64')                                                                 
          HAS_SNI = True                                                                                               
          OP_ALL = 0x80000054                                                                                          
          OP_NO_TLSv1_1 = 0x10000000                                                                                   
test_get_server_certificate (test.test_ssl.SimpleBackgroundTests) ...  server:  new connection from ('127.0.0.1', 51163)

 server:  bad connection attempt from ('127.0.0.1', 51163):                                                            
Traceback (most recent call last):
   File "/Users/erlendaasland/src/cpython-ssl/Lib/test/test_ssl.py", line 2366, in wrap_conn                           
    self.sslconn = self.server.context.wrap_socket(
   File "/Users/erlendaasland/src/cpython-ssl/Lib/ssl.py", line 518, in wrap_socket                                    
    return self.sslsocket_class._create(
   File "/Users/erlendaasland/src/cpython-ssl/Lib/ssl.py", line 1070, in _create                                       
    self.do_handshake()
   File "/Users/erlendaasland/src/cpython-ssl/Lib/ssl.py", line 1339, in do_handshake                                  
    self._sslobj.do_handshake()
 OSError: [Errno 41] Protocol wrong type for socket                                                                    
ERROR

======================================================================                                                 
ERROR: test_get_server_certificate (test.test_ssl.SimpleBackgroundTests)                                               
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erlendaasland/src/cpython-ssl/Lib/test/test_ssl.py", line 2130, in test_get_server_certificate          
    _test_get_server_certificate(self, *self.server_addr, cert=SIGNING_CA)
  File "/Users/erlendaasland/src/cpython-ssl/Lib/test/test_ssl.py", line 2327, in _test_get_server_certificate         
    pem = ssl.get_server_certificate((host, port), ca_certs=cert)
  File "/Users/erlendaasland/src/cpython-ssl/Lib/ssl.py", line 1520, in get_server_certificate
    with create_connection(addr, timeout=timeout) as sock:
  File "/Users/erlendaasland/src/cpython-ssl/Lib/socket.py", line 844, in create_connection                            
    raise err
  File "/Users/erlendaasland/src/cpython-ssl/Lib/socket.py", line 832, in create_connection                            
    sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused

---------------------------------------------------------------------- 


The mock server fails with EPROTOTYPE, thus the client fails with connection refused.

I found similar issues after doing some googling:
- http://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/
- https://github.com/benoitc/gunicorn/issues/1487#issuecomment-333680970

This might be the same macOS bug.
History
Date User Action Args
2021-05-29 21:44:55erlendaaslandsetrecipients: + erlendaasland, christian.heimes, pablogsal
2021-05-29 21:44:55erlendaaslandsetmessageid: <1622324695.43.0.479711462601.issue44229@roundup.psfhosted.org>
2021-05-29 21:44:55erlendaaslandlinkissue44229 messages
2021-05-29 21:44:55erlendaaslandcreate