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: EOFError in test_nntplib.NetworkedNNTPTests.test_starttls()
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, martin.panter, python-dev
Priority: normal Keywords: buildbot, patch

Created on 2015-12-14 09:00 by martin.panter, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
starttls_server.py martin.panter, 2015-12-14 09:00
starttls-server.patch martin.panter, 2015-12-16 03:04 review
Messages (4)
msg256374 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-12-14 09:00
The AMD64 Debian root buildbot and the x86 Gentoo Installed with X buildbot have been persistently failing test_nntplib for a while, and I can also reproduce it locally when “test -unetwork” is enabled. Six test cases fail. There is a pause before test_starttls() fails, then all the others fail immediately:

test_newgroups (test.test_nntplib.NetworkedNNTPTests) ... ok
test_over (test.test_nntplib.NetworkedNNTPTests) ... ok
test_starttls (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_unknown_command (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_welcome (test.test_nntplib.NetworkedNNTPTests) ... ok
test_with_statement (test.test_nntplib.NetworkedNNTPTests) ... ok
test_xhdr (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_xover (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_zlogin (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_zzquit (test.test_nntplib.NetworkedNNTPTests) ... ERROR
test_article_head_body (test.test_nntplib.NetworkedNNTP_SSLTests) ... ok
test_capabilities (test.test_nntplib.NetworkedNNTP_SSLTests) ... ok

Traceback from first failure:

======================================================================
ERROR: test_starttls (test.test_nntplib.NetworkedNNTPTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/media/disk/home/proj/python/cpython/Lib/test/test_nntplib.py", line 252, in wrapped
    meth(self)
  File "/media/disk/home/proj/python/cpython/Lib/test/test_nntplib.py", line 210, in test_starttls
    self.server.starttls()
  File "/media/disk/home/proj/python/cpython/Lib/nntplib.py", line 1014, in starttls
    self.getcapabilities()
  File "/media/disk/home/proj/python/cpython/Lib/nntplib.py", line 390, in getcapabilities
    resp, caps = self.capabilities()
  File "/media/disk/home/proj/python/cpython/Lib/nntplib.py", line 558, in capabilities
    resp, lines = self._longcmdstring("CAPABILITIES")
  File "/media/disk/home/proj/python/cpython/Lib/nntplib.py", line 525, in _longcmdstring
    resp, list = self._getlongresp(file)
  File "/media/disk/home/proj/python/cpython/Lib/nntplib.py", line 476, in _getlongresp
    resp = self._getresp()
  File "/media/disk/home/proj/python/cpython/Lib/nntplib.py", line 449, in _getresp
    resp = self._getline()
  File "/media/disk/home/proj/python/cpython/Lib/nntplib.py", line 437, in _getline
    if not line: raise EOFError
EOFError

It seems like as soon as the TLS connection is successfully set up, the server (news.trigofacile.com) shuts down the connection.

Would it be appropriate to change this test so that instead of connecting to a remote server, we connect to a local server running in a background thread? I attach a Python script that runs a minimal server with hardcoded responses allowing test_starttls() to pass. Perhaps we could use this for test_starttls(). Maybe even extend it to other remote server tests as well.
msg256468 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015-12-15 16:55
> Would it be appropriate to change this test so that instead of connecting to a remote server, we connect to a local server running in a background thread?

+1. We can host it at pythontest.net if needed. The repo is here: https://hg.python.org/pythontestdotnet/
msg256504 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-12-16 03:00
I don’t think there is much advantage hosting it on pythontest, but thanks for letting me know of the possibility. Here is a patch which runs it in a background localhost thread.
msg258566 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-01-19 01:38
New changeset a9fca95f119a by Martin Panter in branch '3.5':
Issue #25859: Reimplement NNTP test_starttls() using local server
https://hg.python.org/cpython/rev/a9fca95f119a

New changeset c44bfa733526 by Martin Panter in branch 'default':
Issue #25859: Merge NNTP test server from 3.5
https://hg.python.org/cpython/rev/c44bfa733526
History
Date User Action Args
2022-04-11 14:58:24adminsetgithub: 70046
2016-01-19 03:19:14martin.pantersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2016-01-19 01:38:23python-devsetnosy: + python-dev
messages: + msg258566
2015-12-16 03:05:02martin.pantersetfiles: - starttls-server.patch
2015-12-16 03:04:53martin.pantersetfiles: + starttls-server.patch
2015-12-16 03:01:01martin.pantersetfiles: + starttls-server.patch
keywords: + patch
messages: + msg256504

stage: needs patch -> patch review
2015-12-15 16:55:46berker.peksagsetnosy: + berker.peksag

messages: + msg256468
stage: needs patch
2015-12-14 09:00:26martin.pantercreate