Skip to content

multiprocessing.Pool hangs on certain custom Exceptions #103061

@djm4686

Description

@djm4686

Bug report

Reproducing:

import multiprocessing


class MyExc(Exception):
    def __init__(self, stuff):
        super().__init__(stuff.two)


class Stuff:
    def __init__(self):
        self.one = 1
        self.two = 2


def run(_):
    raise MyExc(Stuff())


if __name__ == "__main__":
    with multiprocessing.Pool(3) as pool:
        pool.map(run, [1])

This will cause python to hang indefinitely. The cause is the custom exception initialization.

This will throw an exception in the subprocess and will not fail out
AttributeError: 'int' object has no attribute 'two'

Your environment

CPython 3.10.8
Mac OSX Ventura 13.2

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions