Skip to content

Test test_pool.test_on_ready_counter_is_synchronized may fail if the CPU is under heavy load #415

@FliegendeWurst

Description

@FliegendeWurst

I am trying to execute the tests on version 4.2.1, but I get the error below if I run a lot of other CPU-intensive work in the background.
(the tests all pass if I pause my background processes)

============================= test session starts ==============================
platform linux -- Python 3.12.7, pytest-8.3.3, pluggy-1.5.0
rootdir: /build/source
configfile: setup.cfg
testpaths: t/unit/
collected 81 items

t/unit/test_common.py ........                                           [  9%]
t/unit/test_dummy.py .                                                   [ 11%]
t/unit/test_einfo.py .........                                           [ 22%]
t/unit/test_package.py .                                                 [ 23%]
t/unit/test_pool.py ...F                                                 [ 28%]
t/unit/test_spawn.py ...                                                 [ 32%]
t/unit/test_values.py ....                                               [ 37%]
t/unit/test_win32.py sssssssssssssssssssssssssssssssssssssssssssssssssss [100%]

=================================== FAILURES ===================================
_______________ test_pool.test_on_ready_counter_is_synchronized ________________

self = <t.unit.test_pool.test_pool object at 0x7ffff5bfa810>

    def test_on_ready_counter_is_synchronized(self):
        for ctx in ('spawn', 'fork', 'forkserver'):
            pool = billiard.pool.Pool(processes=1, context=get_context(ctx))
>           pool.apply_async(func, (1,)).get(1)

t/unit/test_pool.py:53:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <ApplyResult: 7 ack:False ready:False>, timeout = 1

    def get(self, timeout=None):
        self.wait(timeout)
        if not self.ready():
>           raise TimeoutError
E           multiprocessing.context.TimeoutError

billiard/pool.py:1785: TimeoutError
=============================== warnings summary ===============================
t/unit/test_pool.py::test_pool::test_exception_traceback_present
t/unit/test_spawn.py::test_spawn::test_set_pdeathsig
t/unit/test_values.py::test_values::test_value
t/unit/test_values.py::test_values::test_rawvalue
  /build/source/billiard/popen_fork.py:70: DeprecationWarning: This process (pid=232) is multi-threaded, use of fork() may lead to deadlocks in the child.
    self.pid = os.fork()

t/unit/test_spawn.py::test_spawn::test_start
  /nix/store/7xi8n243nis25ql9q5hmpjj5zp2p0ygb-python3.12-pytest-8.3.3/lib/python3.12/site-packages/_pytest/python.py:163: PytestReturnNotNoneWarning: Expected None, but t/unit/test_spawn.py::test_spawn::test_start returned 0, which will be an erro
r in a future version of pytest.  Did you mean to use `assert` instead of `return`?
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED t/unit/test_pool.py::test_pool::test_on_ready_counter_is_synchronized - multiprocessing.context.TimeoutError
============= 1 failed, 29 passed, 51 skipped, 5 warnings in 9.35s =============

See NixOS/nixpkgs#357170 for more details.

Metadata

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