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_nntplib: random EOFError in setUpClass() #74374

Closed
vstinner opened this issue Apr 27, 2017 · 15 comments
Closed

test_nntplib: random EOFError in setUpClass() #74374

vstinner opened this issue Apr 27, 2017 · 15 comments
Labels
3.7 (EOL) end of life tests Tests in the Lib/test dir

Comments

@vstinner
Copy link
Member

BPO 30188
Nosy @pitrou, @vstinner, @methane, @koobs
PRs
  • bpo-30188: Catch EOFError in NetworkedNNTPTests #1322
  • [3.6] bpo-30175: Skip client cert tests of test_imaplib (#1320) #1323
  • [3.5] bpo-30175: Skip client cert tests of test_imaplib (#1320) #1324
  • bpo-30188: test_nntplib catch also ssl.SSLEOFError #2843
  • bpo-30188: fix TypeError in test_nntplib #2892
  • Files
  • koobs-freebsd-current-debug.py36.build.419.log
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2018-09-19.23:12:18.222>
    created_at = <Date 2017-04-27.15:07:08.251>
    labels = ['3.7', 'tests']
    title = 'test_nntplib: random EOFError in setUpClass()'
    updated_at = <Date 2018-09-19.23:12:18.221>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2018-09-19.23:12:18.221>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-09-19.23:12:18.222>
    closer = 'vstinner'
    components = ['Tests']
    creation = <Date 2017-04-27.15:07:08.251>
    creator = 'vstinner'
    dependencies = []
    files = ['47100']
    hgrepos = []
    issue_num = 30188
    keywords = []
    message_count = 15.0
    messages = ['292450', '292453', '292454', '292455', '292456', '292463', '292473', '292488', '298966', '298985', '299235', '300823', '300824', '302065', '303334']
    nosy_count = 4.0
    nosy_names = ['pitrou', 'vstinner', 'methane', 'koobs']
    pr_nums = ['1322', '1323', '1324', '2843', '2892']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue30188'
    versions = ['Python 3.5', 'Python 3.6', 'Python 3.7']

    @vstinner
    Copy link
    Member Author

    Example of failure:

    ======================================================================
    ERROR: setUpClass (test.test_nntplib.NetworkedNNTPTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/haypo/prog/python/master/Lib/test/test_nntplib.py", line 289, in setUpClass
        cls.server = cls.NNTP_CLASS(cls.NNTP_HOST, timeout=TIMEOUT, usenetrc=False)
      File "/home/haypo/prog/python/master/Lib/nntplib.py", line 1048, in __init__
        readermode, timeout)
      File "/home/haypo/prog/python/master/Lib/nntplib.py", line 330, in __init__
        self.welcome = self._getresp()
      File "/home/haypo/prog/python/master/Lib/nntplib.py", line 449, in _getresp
        resp = self._getline()
      File "/home/haypo/prog/python/master/Lib/nntplib.py", line 437, in _getline
        if not line: raise EOFError
    EOFError

    Attached PR catch this error and skips the test.

    See also issue bpo-19613 and bpo-19756.

    @vstinner vstinner added 3.7 (EOL) end of life tests Tests in the Lib/test dir labels Apr 27, 2017
    @vstinner
    Copy link
    Member Author

    New changeset 5bccca5 by Victor Stinner in branch 'master':
    bpo-30175: Skip client cert tests of test_imaplib (bpo-1320)
    5bccca5

    @vstinner
    Copy link
    Member Author

    NetworkedNNTPTests uses the NNTP server news.trigofacile.com (port 119). It's possible to connect to this server (IPv4: 91.121.26.68), but recv() returns an empty string.

    @vstinner
    Copy link
    Member Author

    I see 3 options:

    @vstinner
    Copy link
    Member Author

    The news.trigofacile.com server was chosen in the commit 1cb121e (Antoine Pitrou in 2010) which also added the new NetworkedNNTPTests test case.

    @vstinner
    Copy link
    Member Author

    New changeset 4dc3b9c by Victor Stinner in branch '3.6':
    bpo-30175: Skip client cert tests of test_imaplib (bpo-1320) (bpo-1323)
    4dc3b9c

    @vstinner
    Copy link
    Member Author

    New changeset 0eda2d4 by Victor Stinner in branch '3.5':
    bpo-30175: Skip client cert tests of test_imaplib (bpo-1320) (bpo-1324)
    0eda2d4

    @vstinner
    Copy link
    Member Author

    Contact news.trigofacile.com administrator to ask him to repair the NNTP server

    I did that and I got a reply: the server is now fixed! :-D

    The test is now skipped on server failure (in 3.5, 3.6 and master), and the server is repaired. So I close the issue.

    Note: Python 2.7 doesn't have the unit test and so is not impacted.

    @vstinner
    Copy link
    Member Author

    Similar but different error (ssl.SSLEOFError) on AMD64 FreeBSD CURRENT Non-Debug 3.5:

    http://buildbot.python.org/all/builders/AMD64%20FreeBSD%20CURRENT%20Non-Debug%203.5/builds/211/steps/test/logs/stdio

    ======================================================================
    ERROR: setUpClass (test.test_nntplib.NetworkedNNTP_SSLTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/usr/home/buildbot/python/3.5.koobs-freebsd-current.nondebug/build/Lib/test/test_nntplib.py", line 291, in setUpClass
        usenetrc=False)
      File "/usr/home/buildbot/python/3.5.koobs-freebsd-current.nondebug/build/Lib/nntplib.py", line 1077, in __init__
        self.sock = _encrypt_on(self.sock, ssl_context, host)
      File "/usr/home/buildbot/python/3.5.koobs-freebsd-current.nondebug/build/Lib/nntplib.py", line 292, in _encrypt_on
        return context.wrap_socket(sock, server_hostname=hostname)
      File "/usr/home/buildbot/python/3.5.koobs-freebsd-current.nondebug/build/Lib/ssl.py", line 385, in wrap_socket
        _context=self)
      File "/usr/home/buildbot/python/3.5.koobs-freebsd-current.nondebug/build/Lib/ssl.py", line 760, in __init__
        self.do_handshake()
      File "/usr/home/buildbot/python/3.5.koobs-freebsd-current.nondebug/build/Lib/ssl.py", line 996, in do_handshake
        self._sslobj.do_handshake()
      File "/usr/home/buildbot/python/3.5.koobs-freebsd-current.nondebug/build/Lib/ssl.py", line 641, in do_handshake
        self._sslobj.do_handshake()
    ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:719)

    @vstinner vstinner reopened this Jul 24, 2017
    @vstinner
    Copy link
    Member Author

    New changeset 5b4feb7 by Victor Stinner in branch 'master':
    bpo-30188: test_nntplib catch also ssl.SSLEOFError (bpo-2843)
    5b4feb7

    @methane
    Copy link
    Member

    methane commented Jul 26, 2017

    New changeset 067931d by INADA Naoki in branch 'master':
    bpo-30188: fix TypeError in test_nntplib (GH-2892)
    067931d

    @koobs
    Copy link

    koobs commented Aug 25, 2017

    bpo-30188 (and bpo-30188 ?) need merging to 3.6/3.5, 3.6 just failed with:

    ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:748)

    Full build log attached

    @koobs koobs reopened this Aug 25, 2017
    @koobs
    Copy link

    koobs commented Aug 25, 2017

    Apologies I meant 5b4feb7 by haypo and 067931d (also needs merge?) by inada.naoki

    @vstinner
    Copy link
    Member Author

    The SSL EOF error is still common, but in the test, not in setUpClass(). Example:

    http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.x%20Shared%203.x/builds/874/steps/test/logs/stdio

    ======================================================================
    ERROR: test_with_statement (test.test_nntplib.NetworkedNNTP_SSLTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_nntplib.py", line 241, in wrapped
        meth(self)
      File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_nntplib.py", line 263, in test_with_statement
        with self.NNTP_CLASS(self.NNTP_HOST, timeout=TIMEOUT, usenetrc=False) as server:
      File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/nntplib.py", line 1077, in __init__
        self.sock = _encrypt_on(self.sock, ssl_context, host)
      File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/nntplib.py", line 292, in _encrypt_on
        return context.wrap_socket(sock, server_hostname=hostname)
      File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/ssl.py", line 407, in wrap_socket
        _context=self, _session=session)
      File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/ssl.py", line 814, in __init__
        self.do_handshake()
      File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/ssl.py", line 1068, in do_handshake
        self._sslobj.do_handshake()
      File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/ssl.py", line 689, in do_handshake
        self._sslobj.do_handshake()
    ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:864)

    pythininfo:

    ssl.HAS_SNI: True
    ssl.OPENSSL_VERSION: OpenSSL 1.0.1u-freebsd 22 Sep 2016
    ssl.OPENSSL_VERSION_INFO: (1, 0, 1, 21, 15)
    ssl.OP_ALL: 0x800003ff
    ssl.OP_NO_TLSv1_1: 0x10000000

    @vstinner
    Copy link
    Member Author

    Recent failure:

    http://buildbot.python.org/all/builders/x86%20Gentoo%20Non-Debug%20with%20X%203.x/builds/1080/steps/test/logs/stdio

    ======================================================================
    ERROR: test_with_statement (test.test_nntplib.NetworkedNNTP_SSLTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/buildbot/buildarea/3.x.ware-gentoo-x86.nondebug/build/Lib/test/test_nntplib.py", line 241, in wrapped
        meth(self)
      File "/buildbot/buildarea/3.x.ware-gentoo-x86.nondebug/build/Lib/test/test_nntplib.py", line 263, in test_with_statement
        with self.NNTP_CLASS(self.NNTP_HOST, timeout=TIMEOUT, usenetrc=False) as server:
      File "/buildbot/buildarea/3.x.ware-gentoo-x86.nondebug/build/Lib/nntplib.py", line 1077, in __init__
        self.sock = _encrypt_on(self.sock, ssl_context, host)
      File "/buildbot/buildarea/3.x.ware-gentoo-x86.nondebug/build/Lib/nntplib.py", line 292, in _encrypt_on
        return context.wrap_socket(sock, server_hostname=hostname)
      File "/buildbot/buildarea/3.x.ware-gentoo-x86.nondebug/build/Lib/ssl.py", line 411, in wrap_socket
        _session=session
      File "/buildbot/buildarea/3.x.ware-gentoo-x86.nondebug/build/Lib/ssl.py", line 822, in __init__
        self.do_handshake()
      File "/buildbot/buildarea/3.x.ware-gentoo-x86.nondebug/build/Lib/ssl.py", line 1076, in do_handshake
        self._sslobj.do_handshake()
      File "/buildbot/buildarea/3.x.ware-gentoo-x86.nondebug/build/Lib/ssl.py", line 697, in do_handshake
        self._sslobj.do_handshake()
    ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:864)

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life tests Tests in the Lib/test dir
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants