Skip to content

buildbot: test_cmd_line failure on Tiger: [Errno 9] Bad file descriptor #52704

Closed

Description

@vstinner
BPO 8458
Nosy @gpshead, @db3l, @ronaldoussoren, @ncoghlan, @pitrou, @vstinner, @ned-deily

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-01-06.00:18:15.914>
created_at = <Date 2010-04-19.11:53:45.728>
labels = ['tests', 'type-bug', 'library']
title = 'buildbot: test_cmd_line failure on Tiger: [Errno 9] Bad file descriptor'
updated_at = <Date 2011-01-06.00:18:15.913>
user = 'https://github.com/vstinner'

bugs.python.org fields:

activity = <Date 2011-01-06.00:18:15.913>
actor = 'pitrou'
assignee = 'none'
closed = True
closed_date = <Date 2011-01-06.00:18:15.914>
closer = 'pitrou'
components = ['Library (Lib)', 'Tests']
creation = <Date 2010-04-19.11:53:45.728>
creator = 'vstinner'
dependencies = []
files = []
hgrepos = []
issue_num = 8458
keywords = ['buildbot']
message_count = 14.0
messages = ['103583', '103584', '103598', '121275', '124320', '124321', '125260', '125263', '125277', '125306', '125352', '125354', '125357', '125486']
nosy_count = 7.0
nosy_names = ['gregory.p.smith', 'db3l', 'ronaldoussoren', 'ncoghlan', 'pitrou', 'vstinner', 'ned.deily']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue8458'
versions = ['Python 3.2']

Activity

  1. vstinner commented on Apr 19, 2010

    @vstinner
    MemberAuthor

    The error only occured once, and it was not reproduced when test_cmd_line was rerunning in verbose mode.

    http://www.python.org/dev/buildbot/builders/x86 Tiger 3.x/builds/25/steps/test/logs/stdio

    test test_cmd_line failed -- Traceback (most recent call last):
      File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_cmd_line.py", line 58, in test_q
        self.verify_valid_flag('-Qold')
      File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_cmd_line.py", line 49, in verify_valid_flag
        data = self.start_python(cmd_line)
      File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_cmd_line.py", line 34, in start_python
        p = spawn_python(*args)
      File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/script_helper.py", line 29, in spawn_python
        stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
      File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/subprocess.py", line 694, in __init__
        self.stdin = io.open(p2cwrite, 'wb', bufsize)
    OSError: [Errno 9] Bad file descriptor

    Re-running test test_cmd_line in verbose mode
    test_directories (test.test_cmd_line.CmdLineTest) ... ok
    test_large_PYTHONPATH (test.test_cmd_line.CmdLineTest) ... ok
    test_optimize (test.test_cmd_line.CmdLineTest) ... ok
    test_q (test.test_cmd_line.CmdLineTest) ... ok
    test_run_code (test.test_cmd_line.CmdLineTest) ... ok
    test_run_module (test.test_cmd_line.CmdLineTest) ... ok
    test_run_module_bug1764407 (test.test_cmd_line.CmdLineTest) ... ok
    test_site_flag (test.test_cmd_line.CmdLineTest) ... ok
    test_unbuffered_input (test.test_cmd_line.CmdLineTest) ... ok
    test_unbuffered_output (test.test_cmd_line.CmdLineTest) ... ok
    test_usage (test.test_cmd_line.CmdLineTest) ... ok
    test_verbose (test.test_cmd_line.CmdLineTest) ... ok
    test_version (test.test_cmd_line.CmdLineTest) ... ok

    ----------------------------------------------------------------------
    Ran 13 tests in 3.860s

    OK

  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    testsTests in the Lib/test dir
    on Apr 19, 2010
  3. vstinner commented on Apr 19, 2010

    @vstinner
    MemberAuthor

    See also bpo-8457.

  4. ned-deily commented on Apr 19, 2010

    @ned-deily
    Member

    I have also seen this test failure occasionally but only on OS X 10.4 systems, not 10.5 or 10.6.

  5. ned-deily commented on Nov 16, 2010

    @ned-deily
    Member

    With 3.2a4, OS X 10.4 Tiger buildbot failures reported:

    ======================================================================
    ERROR: test_run_code (test.test_cmd_line.CmdLineTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/buildbot/buildarea/3.x.parc-tiger-1/build/Lib/test/test_cmd_line.py", line 95, in test_run_code
        assert_python_failure('-c')
      File "/Users/buildbot/buildarea/3.x.parc-tiger-1/build/Lib/test/script_helper.py", line 55, in assert_python_failure
        return _assert_python(False, *args, **env_vars)
      File "/Users/buildbot/buildarea/3.x.parc-tiger-1/build/Lib/test/script_helper.py", line 29, in _assert_python
        env=env)
      File "/Users/buildbot/buildarea/3.x.parc-tiger-1/build/Lib/subprocess.py", line 683, in __init__
        self.stdin = io.open(p2cwrite, 'wb', bufsize)
    OSError: [Errno 9] Bad file descriptor

    ======================================================================
    ERROR: test_run_module (test.test_cmd_line.CmdLineTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/buildbot/buildarea/3.x.parc-tiger-1/build/Lib/test/test_cmd_line.py", line 72, in test_run_module
        assert_python_failure('-m')
      File "/Users/buildbot/buildarea/3.x.parc-tiger-1/build/Lib/test/script_helper.py", line 55, in assert_python_failure
        return _assert_python(False, *args, **env_vars)
      File "/Users/buildbot/buildarea/3.x.parc-tiger-1/build/Lib/test/script_helper.py", line 29, in _assert_python
        env=env)
      File "/Users/buildbot/buildarea/3.x.parc-tiger-1/build/Lib/subprocess.py", line 683, in __init__
        self.stdin = io.open(p2cwrite, 'wb', bufsize)
    OSError: [Errno 9] Bad file descriptor

    ======================================================================
    ERROR: test_version (test.test_cmd_line.CmdLineTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/buildbot/buildarea/3.x.parc-tiger-1/build/Lib/test/test_cmd_line.py", line 48, in test_version
        rc, out, err = assert_python_ok('-V')
      File "/Users/buildbot/buildarea/3.x.parc-tiger-1/build/Lib/test/script_helper.py", line 48, in assert_python_ok
        return _assert_python(True, *args, **env_vars)
      File "/Users/buildbot/buildarea/3.x.parc-tiger-1/build/Lib/test/script_helper.py", line 29, in _assert_python
        env=env)
      File "/Users/buildbot/buildarea/3.x.parc-tiger-1/build/Lib/subprocess.py", line 683, in __init__
        self.stdin = io.open(p2cwrite, 'wb', bufsize)
    OSError: [Errno 9] Bad file descriptor

    On my 10.4 system, it seems to be a race condition: sometimes I see all three of these failures, sometimes just one, sometimes none. Again, only on 10.4 (Tiger), not 10.5 or 10.6. But the 10.4 machine I'm using is by far the slowest of the three so it is possible that could be a factor. Perhaps there is a race condition with cleaning up the p2c pipe from a previous run?

  6. ned-deily commented on Dec 18, 2010

    @ned-deily
    Member

    See also msg124254.

  7. pitrou commented on Dec 18, 2010

    @pitrou
    Member

    Perhaps there is a race condition with cleaning up the p2c pipe from a
    previous run?

    This would be rather strange, since it would have a different file descriptor. Or it means there's a bug somewgere (perhaps in subprocess, or perhaps even in io.open).
    It someone can reproduce even intermittently on their home machine, it would be nice to dig a bit deeper.

  8. gpshead commented on Jan 4, 2011

    @gpshead
    Member

    The code surrounding the p2c file descriptors in subprocess has changed a bit recently since this issue was filed. someone still needs to come up with a way to reproduce it.

  9. removed their assignment
    on Jan 4, 2011
  10. pitrou commented on Jan 4, 2011

    @pitrou
    Member

    Well, it occurred today again :)
    http://www.python.org/dev/buildbot/all/builders/x86%20Tiger%203.x/builds/1884/steps/test/logs/stdio

    test test_cmd_line failed -- Traceback (most recent call last):
      File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_cmd_line.py", line 95, in test_run_code
        assert_python_failure('-c')
      File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/script_helper.py", line 57, in assert_python_failure
        return _assert_python(False, *args, **env_vars)
      File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/script_helper.py", line 30, in _assert_python
        env=env)
      File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/subprocess.py", line 721, in __init__
        self.stdin = io.open(p2cwrite, 'wb', bufsize)
    OSError: [Errno 9] Bad file descriptor

    But I would suggest an OS X bug instead. My random guess is that the child process exits very quickly (as you see, it runs "python -c" which is an immediate error), therefore the other end of the pipe gets closed and OS X then returns EBADF when we try to do something with our end of the pipe.

  11. gpshead commented on Jan 4, 2011

    @gpshead
    Member

    that race condition, if thats what this is, is likely not OS X specific. the child process could complete or close its fds before we reach that code on any OS. We either need to guard these io.open(p2c*...) lines against EBADF OSError's or we should create the io wrappers before _execute_child() is called.

  12. pitrou commented on Jan 4, 2011

    @pitrou
    Member

    that race condition, if thats what this is, is likely not OS X
    specific. the child process could complete or close its fds before we
    reach that code on any OS. We either need to guard these
    io.open(p2c*...) lines against EBADF OSError's or we should create the
    io wrappers before _execute_child() is called.

    Creating them before _execute_child() is the obvious and simple solution
    (if my diagnosis is correct). Is there any downside to doing so?

  13. gpshead commented on Jan 4, 2011

    @gpshead
    Member

    Off the top of my head I don't _think_ so.. at least for posix. I'm not sure about the implications of the if mswindows: code in there though.

  14. pitrou commented on Jan 4, 2011

    @pitrou
    Member

    Well we could try a run of it on the buildbots, then :)

  15. pitrou commented on Jan 4, 2011

    @pitrou
    Member

    Trying it in r87744.

  16. pitrou commented on Jan 6, 2011

    @pitrou
    Member

    I'm closing it in the hope that it's fixed. If it reappears, we'll have to reopen.

  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