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

Python 2.2.3 crashes using popen2 to spawn lots of children #39876

Closed
frankty mannequin opened this issue Jan 28, 2004 · 2 comments
Closed

Python 2.2.3 crashes using popen2 to spawn lots of children #39876

frankty mannequin opened this issue Jan 28, 2004 · 2 comments

Comments

@frankty
Copy link
Mannequin

frankty mannequin commented Jan 28, 2004

BPO 886492
Files
  • bug.zip: zip with test case, drwatson file and hack
  • 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 2006-03-23.08:50:17.000>
    created_at = <Date 2004-01-28.20:33:45.000>
    labels = ['OS-windows']
    title = 'Python 2.2.3 crashes using popen2 to spawn lots of children'
    updated_at = <Date 2006-03-23.08:50:17.000>
    user = 'https://bugs.python.org/frankty'

    bugs.python.org fields:

    activity = <Date 2006-03-23.08:50:17.000>
    actor = 'nnorwitz'
    assignee = 'none'
    closed = True
    closed_date = None
    closer = None
    components = ['Windows']
    creation = <Date 2004-01-28.20:33:45.000>
    creator = 'frankty'
    dependencies = []
    files = ['1191']
    hgrepos = []
    issue_num = 886492
    keywords = []
    message_count = 2.0
    messages = ['19842', '19843']
    nosy_count = 2.0
    nosy_names = ['nnorwitz', 'frankty']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue886492'
    versions = ['Python 2.2']

    @frankty
    Copy link
    Mannequin Author

    frankty mannequin commented Jan 28, 2004

    WinPython 2.3.3 crashes when using popen2 to spawn
    *lots* of children > 100.

    Running the test case on either W2k or Wxp causes
    Python 2.3.3 to crash. Looking at the drwatson file,
    it appears to be a race condition where the child is in
    the process of crashing, while the popen2 code in
    posixmodule.c is attempting to PyFile_SetBufSize() on
    one of the pipes. Evil juju in ntdll.dll ..

    I've no idea what system resource is being exhausted
    (heap memory?) causing the crash.

    If you look at the hacks in posixmodule.c, the Python
    crash can be eliminated by simply commenting out the
    calls to PyFile_SetBufSize. There is still the problem
    of resource exhaustion. To gain more child processes I
    included a hack such that with the setting of an
    env-var (NOPYCMD) popen2 will NOT use cmd.exe /c to run
    a child, but simply run the child command as passed
    (yeah, I know that is has to be an absolute path or in
    the CWD then ..).

    I'm sure there is a better way to eliminate the cmd.exe
    /c - like maybe a new method: popen2.popenXabspath ..

    In any case, it appears we have an NT kernel bug
    combined with an inefficient way of doing popen2 that
    is making a mess. I started doing some exploration of
    heap_chunk_size to attack to resource issue but haven't
    gotten very far.

    As for *why* I'm doing this, it's because we're using
    Pyton as a system simulator tool to emulate a large
    pile of PCs. The actual work *must* be done by
    external .exe code that cannot be changed.

    The attached zip contains a test case, the posixmodule
    hack, drwatson file and a sample program written in
    VisC++ which does basically the same as the Python test
    case.

    cheers,

    • Frank

    @frankty frankty mannequin closed this as completed Jan 28, 2004
    @frankty frankty mannequin added the OS-windows label Jan 28, 2004
    @nnorwitz
    Copy link
    Mannequin

    nnorwitz mannequin commented Mar 23, 2006

    Logged In: YES
    user_id=33168

    Dupe of 886488

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    No branches or pull requests

    0 participants