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_os TestInvalidFD.test_closerange causes test_pipes hang in certain circumstances on linux #50791

Closed
bitdancer opened this issue Jul 22, 2009 · 7 comments
Assignees
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@bitdancer
Copy link
Member

BPO 6542
Nosy @avassalotti, @bitdancer
Files
  • issue6542.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 = 'https://github.com/bitdancer'
    closed_at = <Date 2009-07-22.18:30:52.899>
    created_at = <Date 2009-07-22.02:32:02.293>
    labels = ['type-bug', 'tests']
    title = 'test_os TestInvalidFD.test_closerange causes test_pipes hang in certain circumstances on linux'
    updated_at = <Date 2009-07-22.18:30:52.897>
    user = 'https://github.com/bitdancer'

    bugs.python.org fields:

    activity = <Date 2009-07-22.18:30:52.897>
    actor = 'r.david.murray'
    assignee = 'r.david.murray'
    closed = True
    closed_date = <Date 2009-07-22.18:30:52.899>
    closer = 'r.david.murray'
    components = ['Tests']
    creation = <Date 2009-07-22.02:32:02.293>
    creator = 'r.david.murray'
    dependencies = []
    files = ['14535']
    hgrepos = []
    issue_num = 6542
    keywords = ['patch']
    message_count = 7.0
    messages = ['90791', '90793', '90796', '90799', '90801', '90816', '90818']
    nosy_count = 2.0
    nosy_names = ['alexandre.vassalotti', 'r.david.murray']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue6542'
    versions = ['Python 2.6', 'Python 3.1', 'Python 2.7', 'Python 3.2']

    @bitdancer
    Copy link
    Member Author

    The test sequence "test_ttk_guionly test_os test_pipes" hangs almost
    every time when run on Gentoo x86 and Ubuntu x86_64 (at least). Note
    that this is without the gui resource, so the ttk tests aren't being run.

    Commenting out test_closerange in TestInvalidFD in test_os clears the
    hang. Playing around with which module imports are commented out in
    test_ttk_guionly can clear the hang, but test_pipes then produces the
    following errors:

    ======================================================================
    ERROR: testSimplePipe1 (test.test_pipes.SimplePipeTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/rdmurray/python/py3k/Lib/test/test_pipes.py", line 23, in
    testSimplePipe1
        f = t.open(TESTFN, 'w')
      File "/home/rdmurray/python/py3k/Lib/pipes.py", line 148, in open
        return self.open_w(file)
      File "/home/rdmurray/python/py3k/Lib/pipes.py", line 168, in open_w
        return os.popen(cmd, 'w')
      File "/home/rdmurray/python/py3k/Lib/os.py", line 636, in popen
        bufsize=buffering)
      File "/home/rdmurray/python/py3k/Lib/subprocess.py", line 646, in __init__
        errread, errwrite)
      File "/home/rdmurray/python/py3k/Lib/subprocess.py", line 1138, in
    _execute_child
        os.close(errpipe_read)
    OSError: [Errno 9] Bad file descriptor

    ======================================================================
    FAIL: testSimplePipe2 (test.test_pipes.SimplePipeTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/rdmurray/python/py3k/Lib/test/test_pipes.py", line 33, in
    testSimplePipe2
        self.assertEqual(open(TESTFN2).read(), 'HELLO WORLD #2')
    AssertionError: '' != 'HELLO WORLD #2'

    The first of these appears almost every time, the second one seldom.
    Occasinally both tests pass.

    @bitdancer bitdancer added tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Jul 22, 2009
    @bitdancer
    Copy link
    Member Author

    It appears that TestInvalidFD.test_closerange is in fact closing a valid
    file descriptor in this case. I'm not sure how to fix the test...nor
    why the close produced the results it does.

    @bitdancer
    Copy link
    Member Author

    Here's another buildbot failure that's probably the same thing:

    http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1220

    @bitdancer
    Copy link
    Member Author

    Patch to skip test if it can't get a range of invalid file descriptors
    to test. The test sequence passes with this patch in place.

    @bitdancer bitdancer self-assigned this Jul 22, 2009
    @avassalotti
    Copy link
    Member

    Oh, nice catch. That patch looks fine. However, I would probably add a
    comment why the fstat checks are required.

    @bitdancer
    Copy link
    Member Author

    Applied in r74171 to py3k and r74172 to 3.1.

    It occurs to me that I should backport this to trunk, so I'm leaving the
    issue open until I do that.

    @bitdancer
    Copy link
    Member Author

    Backported to trunk in r74175, and 2.6 in r74176.

    @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
    tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants