8000 gh-134954: Hard-cap max file descriptors in subprocess test fd_status… · python/cpython@f58873e · GitHub
[go: up one dir, main page]

Skip to content
  • Commit f58873e

    Browse files
    authored
    gh-134954: Hard-cap max file descriptors in subprocess test fd_status (#134955)
    * Hard-cap max file descriptors in subprocess test fd_status On some systems, `SC_OPEN_MAX` may return a very large value (i.e. 10**30), leading to the subprocess test timing out (or run forever). Prevent this situation by applying a hard cap on how many file descriptors are checked. * Fix typo in usage docstring s/fd_stats/fd_status/
    1 parent 5507eff commit f58873e

    File tree

    1 file changed

    +2
    -2
    lines changed

    1 file changed

    +2
    -2
    lines changed

    Lib/test/subprocessdata/fd_status.py

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -2,7 +2,7 @@
    22
    file descriptors on stdout.
    33
    44
    Usage:
    5-
    fd_stats.py: check all file descriptors
    5+
    fd_status.py: check all file descriptors (up to 255)
    66
    fd_status.py fd1 fd2 ...: check only specified file descriptors
    77
    """
    88

    @@ -18,7 +18,7 @@
    1818
    _MAXFD = os.sysconf("SC_OPEN_MAX")
    1919
    except:
    2020
    _MAXFD = 256
    21-
    test_fds = range(0, _MAXFD)
    21+
    test_fds = range(0, min(_MAXFD, 256))
    2222
    else:
    2323
    test_fds = map(int, sys.argv[1:])
    2424
    for fd in test_fds:

    0 commit comments

    Comments
     (0)
    0