Skip to content

Hangs after pytest tests complete #67

Open

Description

@ikamensh

Hi,

I am using Pathos to do multiprocessing with objects containing lambda functions. When I run my tests, Pathos doesn't return although tests complete successfully:

(go-ast-go-EjGnZ3Kb-py3.8) ~/P/project (master|●3✚1…) $ pytest .                                                                                                           13:31:38
=============================================================================== test session starts ================================================================================
platform darwin -- Python 3.8.1+, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
rootdir: /Users/username/PycharmProjects/project
plugins: timeout-1.3.4
collected 14 items                                                                                                                                                                 

tests/test_compare.py .                                                                                                                                                      [  7%]
tests/test_continuous.py ...                                                                                                                                                 [ 28%]
tests/test_problem.py .                                                                                                                                                      [ 35%]
tests/test_solution.py .                                                                                                                                                     [ 42%]
tests/test_solver.py ..                                                                                                                                                      [ 57%]
tests/test_tsp.py ......                                                                                                                                                     [100%]

================================================================================ 14 passed in 0.54s ================================================================================
^[[A


^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/lib/python3.8/site-packages/multiprocess/util.py", line 277, in _run_finalizers
    finalizer()
  File "/lib/python3.8/site-packages/multiprocess/util.py", line 201, in __call__
    res = self._callback(*self._args, **self._kwargs)
  File "/lib/python3.8/site-packages/multiprocess/pool.py", line 689, in _terminate_pool
    cls._help_stuff_finish(inqueue, task_handler, len(pool))
  File "/lib/python3.8/site-packages/multiprocess/pool.py", line 674, in _help_stuff_finish
    inqueue._rlock.acquire()
KeyboardInterrupt

Similar problem occured when I had some faulty code and it raised exception in one of the subprocesses - the whole program didn't terminate, and hanged until given a KeyboardInterrupt.

OS: macOS 10.14.6

Activity

  1. changed the title [-]Hangs after tests complete[/-] [+]Hangs after pytest tests complete[/+] on Feb 14, 2020
  2. mmckerns commented on Jun 12, 2021

    @mmckerns
    Member

    I think pytest doesn't play well with mutiprocessing (and hence pathos). Specifically I've been rolling my own tests in test.__main__ and not using pytest since reading the pytest docs a way back, and seeing notes about issues with multiprocessing.

    I am on the fence about putting pytest support in "won't-fix", so I'll leave this open for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions