Skip to content

test_nntplib: sporadic failures, test_article_head_body() #63812

Closed

Description

@vstinner
BPO 19613
Nosy @vstinner, @mcepl, @berkerpeksag, @vadmium, @koobs
Files
  • koobs-freebsd-10-python-3x-build-4682.txt
  • ending-dot.patch
  • ending-dot.v2.patch
  • 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 = None
    created_at = <Date 2013-11-15.17:30:45.877>
    labels = ['type-bug', 'tests']
    title = 'test_nntplib: sporadic failures, test_article_head_body()'
    updated_at = <Date 2020-05-22.21:28:47.631>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2020-05-22.21:28:47.631>
    actor = 'chris.jerdonek'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Tests']
    creation = <Date 2013-11-15.17:30:45.877>
    creator = 'vstinner'
    dependencies = []
    files = ['43901', '43903', '43905']
    hgrepos = []
    issue_num = 19613
    keywords = ['patch', 'buildbot']
    message_count = 19.0
    messages = ['202961', '224475', '224476', '224481', '245538', '268972', '271423', '271426', '271428', '271429', '297134', '297529', '306936', '325829', '325921', '325923', '325924', '343039', '369649']
    nosy_count = 5.0
    nosy_names = ['vstinner', 'mcepl', 'berker.peksag', 'martin.panter', 'koobs']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue19613'
    versions = ['Python 3.5', 'Python 3.6']

    Activity

    1. vstinner commented on Nov 15, 2013

      @vstinner
      MemberAuthor

      http://buildbot.python.org/all/builders/AMD64%20Ubuntu%20LTS%203.x/builds/3024/steps/test/logs/stdio

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

      Traceback (most recent call last):
        File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_nntplib.py", line 251, in wrapped
          meth(self)
        File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_nntplib.py", line 178, in test_article_head_body
          self.check_article_resp(resp, body, art_num)
        File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_nntplib.py", line 158, in check_article_resp
          self.assertNotIn(article.lines[-1], (b".", b".\n", b".\r\n"))
      IndexError: list index out of range

      (...)
      Re-running failed tests in verbose mode
      Re-running test 'test_nntplib' in verbose mode
      (...)
      test_article_head_body (test.test_nntplib.NetworkedNNTPTests) ... ok

    2. BreamoreBoy commented on Aug 1, 2014

      BreamoreBoymannequin
      Mannequin

      The last five builds have been successful so can this be closed as "out of date"?

    3. vstinner commented on Aug 1, 2014

      @vstinner
      MemberAuthor

      The last five builds have been successful so can this be closed as "out of date"?

      Really? I saw a lot of test_nntplib failures this week, on Windows buildbots for example.

    4. vstinner commented on Aug 1, 2014

      @vstinner
      MemberAuthor

      Well, it's not exactly the same error, but it's still "sporadic failure" of test_nntp. Example:

      http://buildbot.python.org/all/builders/x86%20Windows7%203.x/builds/8578/steps/test/logs/stdio

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

      Traceback (most recent call last):
        File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_nntplib.py", line 251, in wrapped
          meth(self)
        File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_nntplib.py", line 229, in test_zlogin
          user=baduser, password=badpw, usenetrc=False)
        File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", line 704, in assertRaises
          return context.handle('assertRaises', callableObj, args, kwargs)
        File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", line 162, in handle
          callable_obj(*args, **kwargs)
        File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\nntplib.py", line 963, in login
          resp = self._shortcmd('authinfo user ' + user)
        File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\nntplib.py", line 512, in _shortcmd
          return self._getresp()
        File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\nntplib.py", line 450, in _getresp
          resp = self._getline()
        File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\nntplib.py", line 433, in _getline
          line = self.file.readline(_MAXLINE +1)
        File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\socket.py", line 514, in readinto
          raise OSError("cannot read from timed out object")
      OSError: cannot read from timed out object
    5. vadmium commented on Jun 20, 2015

      @vadmium
      Member

      The timed out case seems to be similar to bpo-19756.

    6. vadmium commented on Jun 21, 2016

      @vadmium
      Member

      I presume the original report was due to testing when the server happened to return an article with an empty body. The failing test is

      # XXX this could exceptionally happen...
      self.assertNotIn(article.lines[-1], (b".", b".\n", b".\r\n"))

      The test code already admits that what it is testing cannot be guaranteed (an article body could end with a full stop). And we have found another case where the test is not valid (an article with zero lines). I say remove this part of the test, at least when testing the article() and body() methods.

    7. koobs commented on Jul 27, 2016

      @koobs

      This just failed on 3.x (default) on koobs-freebsd{9,10} bots:

      ======================================================================
      FAIL: test_article_head_body (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 240, in wrapped
          meth(self)
        File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_nntplib.py", line 185, in test_article_head_body
          self.check_article_resp(resp, body, art_num)
        File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_nntplib.py", line 165, in check_article_resp
          self.assertNotIn(article.lines[-1], (b".", b".\n", b".\r\n"))
      AssertionError: b'.' unexpectedly found in (b'.', b'.\n', b'.\r\n')

      Full log attached

    8. vadmium commented on Jul 27, 2016

      @vadmium
      Member

      A few other buildbots shared this failure. It would be nice to see what the article is that is causing the failure, but I’m fairly confident we should just remove this part of the test.

    9. vadmium commented on Jul 27, 2016

      @vadmium
      Member

      I played with the server and group that is apparently used in the test:

      >>> server = NNTP_SSL("nntp.aioe.org")
      >>> [_, _, first, last, _] = server.group("fr.comp.lang.python")
      >>> first
      2900
      >>> last
      2915
      >>> server.body(last)[1].lines[-1]
      b''
      >>> server.body(first)[1].lines[-1]
      b'Merci'
      >>> server.body(last - 1)[1].lines[-1]
      b'Kevin'

      I tried all articles from 2900–2915, and none of them end with a dot on its own line, so I don’t actually know what caused the failure.

      However looking again at the _getlongresp() implementation, I cannot imagine how the test failure can occur except for a genuine body that ends with a dot on its own line (encoded as b".." and then converted to b"."). Here is a quick patch to alter the test cases.

    10. vadmium commented on Jul 27, 2016

      @vadmium
      Member

      This version actually works :P

    11. vstinner commented on Jun 28, 2017

      @vstinner
      MemberAuthor

      Sorry, I lost track of this issue. What is the status?

      @martin: Do you want to convert your latest patch into a PR?

    12. vadmium commented on Jul 3, 2017

      @vadmium
      Member

      It looks like I was fairly confident about my patch, but it was all theoretical and I was never able to analyze the failure myself.

      Sorry but I am unlikely to spend much time on this or open a pull request any time soon.

    13. vadmium commented on Nov 25, 2017

      @vadmium
      Member

      Victor opened bpo-32128 with the same complaint. I think I found the offending article:

      >>> server = NNTP_SSL("nntp.aioe.org")
      >>> [response, count, first, last, name] = server.group("comp.lang.python")
      >>> last
      199267
      >>> pprint(server.article(199265)[1].lines)
      [. . .
       b'Date: Fri, 24 Nov 2017 15:44:26 -0800 (PST)',
       . . .
       b'Message-ID: <[email protected]>',
       b'Subject: Re: Python loop and web server (bottle) in the same script (Posting',
       b'     On Python-List Prohibited)',
       . . .
       b'Content-Transfer-Encoding: quoted-printable',
       . . .
       b'If processing is I/O bound and not CPU bound, then asyncio should work fine=',
       b'.']

      The body uses Quoted-printable encoding, and the previous line ends with an equals sign “=”, meaning a soft line break. So the full stop is on its own because the encoder didn’t want to fit it on the previous line. This is valid (albeit quirky) encoding, and not a problem with the NNTP library.

    14. vstinner commented on Sep 19, 2018

      @vstinner
      MemberAuthor

      I suggest to close the issue since the bug didn't show up recently.

    15. berkerpeksag commented on Sep 20, 2018

      @berkerpeksag
      Member

      The test_article_head_body test is now skipped unconditionally:

      @unittest.skipIf(True, "FIXME: see bpo-32128")
      

      I don't think we should close this issue without re-enabling that test.

    16. vstinner commented on Sep 20, 2018

      @vstinner
      MemberAuthor

      I don't think we should close this issue without re-enabling that test.

      The fact is that nobody cares of test_nntplib: this issue is open for 5 years. I don't see how leaving the issue open which helps. It's fine to skip a test if nobody is available to fix it.

    17. berkerpeksag commented on Sep 20, 2018

      @berkerpeksag
      Member

      Well, no one is going to notice it if we close this issue. I don't see why the age of the issue matters here. We close issues when we fix them. It may take 20 minutes, 5 years or a decade.

      I understand closing an issue as "out of date" when we couldn't find the root of the problem, but in this case the problem is obvious and there is already a patch that tries to fix it.

    18. mcepl commented on May 21, 2019

      mceplmannequin
      Mannequin

      Could anybody make a PR from these patches? @vstinner, would you make me a review if I do it?

    19. cjerdonek commented on May 22, 2020

      @cjerdonek
      Member

      See also: https://bugs.python.org/issue40735 (test_with_statement)

    20. transferred this issue fromon Apr 10, 2022
    21. hugovk commented on Apr 11, 2022

      @hugovk
      Member

      I think we can close this old issue because the nntplib module is deprecated in 3.11 and set for removal in 3.13.

      See PEP 594 – Removing dead batteries from the standard library and #91217.

    22. AlexWaygood commented on Apr 12, 2022

      @AlexWaygood
      Member

      I think we can close this old issue because the nntplib module is deprecated in 3.11 and set for removal in 3.13.

      See PEP 594 – Removing dead batteries from the standard library and #91217.

      Cc. @mcepl, @berkerpeksag, @vadmium, @koobs

    23. mcepl commented on Apr 12, 2022

      @mcepl
      Contributor

      Well, yes, see my comment before. With a little bit of help, I would be willing to take over nntplib as a separate module. Especially if with this PR it could became less dependent on the external servers.

    24. mcepl commented on Apr 12, 2022

      @mcepl
      Contributor

      I did that already when creating https://git.sr.ht/~mcepl/nntplib

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions