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.

classification
Title: test_ssl.py is broken in Centos7
Type: compile error Stage: resolved
Components: Tests Versions: Python 3.5
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: David Antonio Garcia Campos, david-cpi, vstinner, xiang.zhang
Priority: normal Keywords:

Created on 2017-04-29 23:15 by david-cpi, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test.log david-cpi, 2017-04-29 23:15
Messages (10)
msg292608 - (view) Author: (david-cpi) Date: 2017-04-29 23:15
To make the test pass, I added the following try statement:
            try: 
             sock.sendall(buf)
            except:
             pass
msg292731 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-02 09:40
The failure can't be reproduced by me, 3.5 on CentOS 7.1.
msg292736 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-05-02 10:01
@david-cpi: Can you please elaborate?

* What is your Centos full version?
* How do you get Python 3.5? Tarball from python.org?
* What is the error message?

"except: pass" is bad practice, you must catch a specific exception type.

It seems very strange to have to ignore errors on sendall().
msg292737 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-05-02 10:03
Oh, I missed the attached test.log file. So, it's CentOS 7.3.1611 and the full error message is:

== CPython 3.5.2 (default, Apr 29 2017, 16:07:16) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]
==   Linux-3.10.0-514.16.1.el7.x86_64-x86_64-with-centos-7.3.1611-Core little-endian
==   hash algorithm: siphash24 64bit
==   /home/vagrant/Downloads/Python-3.5.2/build/test_python_16502
...
[1/1/1] test_ssl
test_ssl: testing with 'OpenSSL 1.0.1e-fips 11 Feb 2013' (1, 0, 1, 5, 15)
          under Linux ('CentOS Linux', '7.3.1611', 'Core')
          HAS_SNI = True
          OP_ALL = 0x800003f7
          OP_NO_TLSv1_1 = 0x10000000
...
test_read_write_data (test.test_ssl.NetworkedBIOTests) ... Needed 3 calls to complete do_handshake().
Needed 1 calls to complete write().
ERROR
...
======================================================================
ERROR: test_read_write_data (test.test_ssl.NetworkedBIOTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vagrant/Downloads/Python-3.5.2/Lib/test/test_ssl.py", line 1785, in test_read_write_data
    buf = self.ssl_io_loop(sock, incoming, outgoing, sslobj.read, 1024)
  File "/home/vagrant/Downloads/Python-3.5.2/Lib/test/test_ssl.py", line 1724, in ssl_io_loop
    sock.sendall(buf)
BrokenPipeError: [Errno 32] Broken pipe

----------------------------------------------------------------------
Ran 117 tests in 39.538s

FAILED (errors=1, skipped=8)
/home/vagrant/Downloads/Python-3.5.2/Lib/unittest/case.py:628: ResourceWarning: unclosed <socket.socket fd=4, family=AddressFamily.AF_INET, type=2049, proto=0, laddr=('10.0.2.15', 53304)>
  outcome.errors.clear()
test test_ssl failed
msg292738 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-05-02 10:08
David: can you please check if you get the same error with Python 3.6, or even the development version (Git master branch)?
msg292747 - (view) Author: (david-cpi) Date: 2017-05-02 11:28
Hi Victor,
I will try during the day and get back with the logs.
msg292750 - (view) Author: (david-cpi) Date: 2017-05-02 12:23
Hello Victor,

in 3.6.1 the test passes but it's because on sub-test was removed.

The one generating the issue is NetworkedBIOTests which is not found in 3.6.1.

in 3.5.2:
    if support.is_resource_enabled('network'):
        tests.append(NetworkedTests)
        tests.append(NetworkedBIOTests)
in 3.6.1
    if support.is_resource_enabled('network'):
        tests.append(NetworkedTests)
msg292751 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-05-02 12:52
> in 3.6.1 the test passes but it's because on sub-test was removed.

The unit tests still exist and were enhanced.

On Python 3.5, the BIO read-write data test used the external server self-signed.pythontest.net. On Python 3.6, the test now uses a server running locally. See issue #25940 and commit 3840b2ac6728d1940a7efc2ecab2c7d9a100c080.

Note: the failing test was renamed to test_bio_read_write_data.

--

David: You can try the following command to run the failing test in verbose mode (and only run this test). You can add --forever option to run the test in a loop until it fails.

In your output, I see "Needed 3 calls to complete do_handshake(). Needed 1 calls to complete write()." but not "Needed 2 calls to complete read(). Needed 1 calls to complete unwrap().".

For Python 3.5:

haypo@selma$ ./python -m test -u all test_ssl -v -m test_read_write_data

== CPython 3.5.3+ (default, May 2 2017, 11:20:59) [GCC 6.3.1 20161221 (Red Hat 6.3.1-1)]
==   Linux-4.10.11-200.fc25.x86_64-x86_64-with-fedora-25-Twenty_Five little-endian
==   hash algorithm: siphash24 64bit
==   /home/haypo/prog/python/3.5/build/test_python_20359
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0)
[1/1] test_ssl
test_ssl: testing with 'OpenSSL 1.0.2k-fips  26 Jan 2017' (1, 0, 2, 11, 15)
          under Linux ('Fedora', '25', 'Twenty Five')
          HAS_SNI = True
          OP_ALL = 0x800003ff
          OP_NO_TLSv1_1 = 0x10000000
test_read_write_data (test.test_ssl.NetworkedBIOTests) ... Needed 3 calls to complete do_handshake().
Needed 1 calls to complete write().
Needed 2 calls to complete read().
Needed 1 calls to complete unwrap().
ok

----------------------------------------------------------------------
Ran 1 test in 0.456s

OK
1 test OK.


For Python 3.6:

haypo@selma$ ./python -m test test_ssl -v -m test_bio_read_write_data

== CPython 3.6.1+ (default, May 2 2017, 10:23:14) [GCC 6.3.1 20161221 (Red Hat 6.3.1-1)]
==   Linux-4.10.11-200.fc25.x86_64-x86_64-with-fedora-25-Twenty_Five little-endian
==   hash algorithm: siphash24 64bit
==  cwd: /home/haypo/prog/python/3.6/build/test_python_20383
==  encodings: locale=UTF-8, FS=utf-8
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0)
Run tests sequentially
0:00:00 [1/1] test_ssl
test_ssl: testing with 'OpenSSL 1.0.2k-fips  26 Jan 2017' (1, 0, 2, 11, 15)
          under Linux ('Fedora', '25', 'Twenty Five')
          HAS_SNI = True
          OP_ALL = 0x800003ff
          OP_NO_TLSv1_1 = 0x10000000
test_bio_read_write_data (test.test_ssl.SimpleBackgroundTests) ...  server:  new connection from ('127.0.0.1', 42160)
 server: connection cipher is now ('ECDHE-RSA-AES256-SHA', 'TLSv1/SSLv3', 256)
 server: selected protocol is now None
Needed 3 calls to complete do_handshake().
Needed 1 calls to complete write().
Needed 2 calls to complete read().
Needed 2 calls to complete unwrap().
ok

----------------------------------------------------------------------
Ran 1 test in 0.058s

OK
1 test OK.

Total duration: 413 ms
Tests result: SUCCESS
msg333980 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-01-18 15:30
@david-cpi: Ping? Can you please try comments in my previous comment?

Without feedback from your side, I will close the issue as "outdated" in 2 weeks.
msg333982 - (view) Author: David Antonio Garcia Campos (David Antonio Garcia Campos) Date: 2019-01-18 15:48
Hello Victor,
I just saw your message. I will try to setup my enviorment and will come back to you.
BR David Garcia
History
Date User Action Args
2022-04-11 14:58:45adminsetgithub: 74398
2021-09-12 11:39:04iritkatrielsetstatus: open -> closed
resolution: out of date
stage: resolved
2019-01-18 15:48:42David Antonio Garcia Campossetnosy: + David Antonio Garcia Campos
messages: + msg333982
2019-01-18 15:30:16vstinnersetmessages: + msg333980
2017-05-02 12:52:20vstinnersetmessages: + msg292751
2017-05-02 12:23:20david-cpisetmessages: + msg292750
2017-05-02 11:28:36david-cpisetmessages: + msg292747
2017-05-02 10:08:07vstinnersetmessages: + msg292738
2017-05-02 10:03:58vstinnersetmessages: + msg292737
2017-05-02 10:01:45vstinnersetmessages: + msg292736
2017-05-02 09:40:39xiang.zhangsetmessages: + msg292731
2017-04-30 11:40:36xiang.zhangsetnosy: + vstinner, xiang.zhang
2017-04-29 23:15:34david-cpicreate