Skip to content

test_mailbox failure under a Windows VM #53766

Closed

Description

@pitrou
BPO 9557
Nosy @akuchling, @pitrou, @bitdancer
Files
  • test_mailbox_refresh.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 = <Date 2011-03-25.20:23:25.062>
    created_at = <Date 2010-08-10.13:46:09.911>
    labels = ['tests', 'type-bug', 'library']
    title = 'test_mailbox failure under a Windows VM'
    updated_at = <Date 2011-03-25.20:23:25.061>
    user = 'https://github.com/pitrou'

    bugs.python.org fields:

    activity = <Date 2011-03-25.20:23:25.061>
    actor = 'r.david.murray'
    assignee = 'none'
    closed = True
    closed_date = <Date 2011-03-25.20:23:25.062>
    closer = 'r.david.murray'
    components = ['Library (Lib)', 'Tests']
    creation = <Date 2010-08-10.13:46:09.911>
    creator = 'pitrou'
    dependencies = []
    files = ['21391']
    hgrepos = []
    issue_num = 9557
    keywords = ['patch']
    message_count = 14.0
    messages = ['113538', '132089', '132103', '132112', '132116', '132118', '132119', '132121', '132126', '132130', '132133', '132134', '132148', '132149']
    nosy_count = 4.0
    nosy_names = ['akuchling', 'pitrou', 'r.david.murray', 'python-dev']
    pr_nums = []
    priority = 'low'
    resolution = None
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue9557'
    versions = ['Python 3.1', 'Python 2.7', 'Python 3.2', 'Python 3.3']

    Activity

    1. pitrou commented on Aug 10, 2010

      @pitrou
      MemberAuthor

      I get this failure in test_mailbox under Windows XP running in a qemu virtual machine:

      ======================================================================
      FAIL: test_reread (test.test_mailbox.TestMaildir)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "Z:\py3k\debug\lib\test\test_mailbox.py", line 764, in test_reread
          assert not refreshed()
      AssertionError

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      testsTests in the Lib/test dir
      type-bugAn unexpected behavior, bug, or error
      on Aug 10, 2010
    3. removed their assignment
      on Nov 12, 2010
    4. bitdancer commented on Mar 25, 2011

      @bitdancer
      Member

      It is reasonably likely that the attached patch will fix this. It also removes 3 seconds of fixed overhead from the test.

    5. pitrou commented on Mar 25, 2011

      @pitrou
      MemberAuthor

      Well, on my new setup (Windows 7 VM with a Python checkout located on an SMB drive), the test sometimes passes and sometimes fails, regardless of the patch.
      I suspect that maybe maildir requires atomicity guarantees that a network FS won't provide.

    6. bitdancer commented on Mar 25, 2011

      @bitdancer
      Member

      That could be, certainly. The code is depending on the mtime having a resolution of at least one second. Try making the constant 61 instead of 60. If that doesn't work, try putting the mtime back a lot farther and see if that makes it work If it passes with that change then it could be the assumptions made by the code are also incorrect.

    7. pitrou commented on Mar 25, 2011

      @pitrou
      MemberAuthor

      Indeed, 61 seems to work. I don't understand the comment about one-second granularity, shouldn't it be one-minute? (or why do you need 61?)

    8. bitdancer commented on Mar 25, 2011

      @bitdancer
      Member

      Hmm. You are right, I wasn't thinking clearly, and I copied that mtime setting call from another test. Now I have no idea why 61 would work, unless the clock between your virthost and your smb server is off by a minute?

    9. pitrou commented on Mar 25, 2011

      @pitrou
      MemberAuthor

      Hmm. You are right, I wasn't thinking clearly, and I copied that
      mtime setting call from another test. Now I have no idea why 61 would
      work, unless the clock between your virthost and your smb server is
      off by a minute?

      No, they seem exactly synchronized.

    10. bitdancer commented on Mar 25, 2011

      @bitdancer
      Member

      Could you print out the mtime values that are being set, and the value of self._mbox._last_read? Or, rather, print out the result of calls to os.path.getmtime on the two directories after the mtime is changed.

    11. pitrou commented on Mar 25, 2011

      @pitrou
      MemberAuthor

      before: os.path.getmtime('cur') = 1301075411.6942866
      before: os.path.getmtime('new') = 1301075411.693287
      after: os.path.getmtime('cur') = 1301075347.38
      after: os.path.getmtime('new') = 1301075347.38
      self._box._last_read = 1301075407.365
      time.time() = 1301075408.395

      (the test passed here)

    12. bitdancer commented on Mar 25, 2011

      @bitdancer
      Member

      Hmm. 411-61=350. Three seconds difference looks a little odd. But doesn't explain 60 vs 61 making the difference in the test.

      Can you change it back to 60 (or even less) and see what the values look like when the test fails?

      It is interesting (and possibly meaningful) that the last modified time 'before' appears to be in the future compared to time.time by 3-plus seconds. That would at least explain why the test fails without the patch.

    13. pitrou commented on Mar 25, 2011

      @pitrou
      MemberAuthor

      Hmm. 411-61=350. Three seconds difference looks a little odd. But
      doesn't explain 60 vs 61 making the difference in the test.

      Can you change it back to 60 (or even less) and see what the values
      look like when the test fails?

      Hmm, 60 doesn't fail anymore so I changed it to 1 (!) and here is the
      result:

      before: os.path.getmtime('cur') = 1301078411.882165
      before: os.path.getmtime('new') = 1301078411.8801715
      after: os.path.getmtime('cur') = 1301078410.802999
      after: os.path.getmtime('new') = 1301078410.802999
      self._box._last_read = 1301078410.787
      time.time() = 1301078411.818

      (it fails obviously)

      It is interesting (and possibly meaningful) that the last modified
      time 'before' appears to be in the future compared to time.time by
      3-plus seconds. That would at least explain why the test fails
      without the patch.

      Yep, although the drift is varying. Sometimes small, sometimes big. At
      this point I think it's just caused by my setup (the fact that VM and
      host aren't always synchronized - I once witnessed time advancing
      quicker on the VM than on the host! -, and the fact that a network FS is
      used).

    14. bitdancer commented on Mar 25, 2011

      @bitdancer
      Member

      All right, so how about I set the add factor to, say, 5, so that if things are mostly in sync it will succeed, and otherwise just ignore your failures :)

    15. python-dev commented on Mar 25, 2011

      python-devmannequin
      Mannequin

      New changeset 9a184d8211f5 by R David Murray in branch '3.1':
      bpo-9557: eliminate 3 seconds of static overhead from test_mailbox.
      http://hg.python.org/cpython/rev/9a184d8211f5

      New changeset 268ab32a89a9 by R David Murray in branch '3.2':
      Merge bpo-9557: eliminate 3 seconds of static overhead from test_mailbox.
      http://hg.python.org/cpython/rev/268ab32a89a9

      New changeset 03c7a83bbdd3 by R David Murray in branch 'default':
      Merge bpo-9557: eliminate 3 seconds of static overhead from test_mailbox.
      http://hg.python.org/cpython/rev/03c7a83bbdd3

    16. bitdancer commented on Mar 25, 2011

      @bitdancer
      Member

      Antoine agreed in IRC that this was an acceptable closure.

    17. transferred this issue fromon Apr 10, 2022
    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

      stdlibStandard Library Python modules in the Lib/ directorytestsTests 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