Skip to content

blosc2 freezes when used in a ProcessPoolExecutor -- fine in a ThreadPoolExecutor #237

Open
@tazr

Description

from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor

import blosc2
import numpy as np


def test(arr):
    print("test begins")
    blosc2.pack_array(arr)
    print("test ends")


def main():
    arrs = [np.random.randint(255, size=(1024, 1024), dtype=np.uint8) for _ in range(20)]

    with ThreadPoolExecutor(max_workers=2) as pool:
        for arr in arrs:
            pool.submit(test, arr=arr)

    print("threadpool done")
    with ProcessPoolExecutor(max_workers=2) as pool:
        for arr in arrs:
            pool.submit(test, arr=arr)
    print("processpool done")  # never printed


if __name__ == "__main__":
    main()

I tried to set blosc2.ncores/nthreads to 1 but to no avail.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions