Skip to content

Multiprocessing exitcode=None after join #148318

@uraniumCoder

Description

@uraniumCoder

Bug report

Bug description:

I sometimes observe exitcode=None after joining a process.

import multiprocessing as mp
import sys
import threading

sys.setswitchinterval(1e-6)
ctx = mp.get_context("fork")
failures = []

def lifecycle(n_iters=100, n_procs=4):
    for _ in range(n_iters):
        ps = [ctx.Process(target=int, daemon=True) for _ in range(n_procs)]
        for p in ps: 
            p.start()
        for p in ps:
            p.join()
            if p.exitcode is None: 
                failures.append(p.pid)

ts = [threading.Thread(target=lifecycle) for _ in range(2)]
for t in ts: 
    t.start()
for t in ts: 
    t.join()
print(f"{len(failures)}/{2*100*4} had exitcode=None after join()")

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-multiprocessingtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions