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

[multiprocessing] Handle died subprocesses #265

Open
ddelange opened this issue Apr 27, 2023 · 0 comments
Open

[multiprocessing] Handle died subprocesses #265

ddelange opened this issue Apr 27, 2023 · 0 comments

Comments

@ddelange
Copy link
Contributor

ddelange commented Apr 27, 2023

Hi 👋

Please consider the following example, where a subprocess tries to allocate more RAM than is available on the system. This snippet will hang/never finish/not raise an exception.

from pathos.multiprocessing import ProcessPool
from random import random

def outofmemory(*args):
    mem = []
    while True:
        mem.append([random() for _ in range(10000)])

for nope in ProcessPool(2).imap(outofmemory, [1, 2]):
    pass

In kubernetes clusters (also local dockerd if you set a container memory limit), subprocesses in a Pod will be SIGKILL'ed at any time and without warning to prevent PID 1 of the Pod going Out of Memory based on its resources.limits.memory spec (ref).

Can iterating over the imap raise an exception when one of the subprocesses dies unexpectedly (so not due to maxtasksperchild)?

Originally posted by @thoughtfuldata in ddelange/mapply#43

@ddelange ddelange changed the title Propagate OOM errors [multiprocessing] Propagate OOM errors Jul 30, 2023
@ddelange ddelange changed the title [multiprocessing] Propagate OOM errors [multiprocessing] Propagate OOM errors / Handle died subprocesses Aug 28, 2024
@ddelange ddelange changed the title [multiprocessing] Propagate OOM errors / Handle died subprocesses [multiprocessing] Handle died subprocesses Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant