django parallel tests hang in multiprocessing pool System check identified no issues (0 silenced).

While running:

./manage.py test --verbosity 3 --parallel=16 --keepdb $UNIT_TESTS

The tests appear to be hanging on the multiprocessing pool.

When I ^C and ^D out of the processes, pdb catches the other side of the exit and appears to do some atexit cleanup just fine.

    self.default_handler(signum, frame)
KeyboardInterrupt
KeyboardInterrupt
  File "/home/jm/.pyenv/versions/3.9.10/lib/python3.9/unittest/signals.py", line 36, in __call__
    self.default_handler(signum, frame)
KeyboardInterrupt
  File "/home/jm/.pyenv/versions/3.9.10/lib/python3.9/unittest/signals.py", line 36, in __call__
    self.default_handler(signum, frame)
KeyboardInterrupt
KeyboardInterrupt
--KeyboardInterrupt--
(Pdb) 
Preserving test database for alias 'default' ('test_circus_1')...
Preserving test database for alias 'default' ('test_circus_2')...
Preserving test database for alias 'default' ('test_circus_3')...
Preserving test database for alias 'default' ('test_circus_4')...
Preserving test database for alias 'default' ('test_circus_5')...
Preserving test database for alias 'default' ('test_circus_6')...
Preserving test database for alias 'default' ('test_circus_7')...
Preserving test database for alias 'default' ('test_circus_8')...
Preserving test database for alias 'default' ('test_circus_9')...
Preserving test database for alias 'default' ('test_circus_10')...
Preserving test database for alias 'default' ('test_circus_11')...
Preserving test database for alias 'default' ('test_circus_12')...
Preserving test database for alias 'default' ('test_circus_13')...
Preserving test database for alias 'default' ('test_circus_14')...
Preserving test database for alias 'default' ('test_circus_15')...
Preserving test database for alias 'default' ('test_circus_16')...
Preserving test database for alias 'default' ('test_circus')...

Any suggestions?

Versions:

  • django 3.2
  • python 3.9.10
class ParallelTestSuite(unittest.TestSuite):
    """
    Run a series of tests in parallel in several processes.

    While the unittest module's documentation implies that orchestrating the
    execution of tests is the responsibility of the test runner, in practice,
    it appears that TestRunner classes are more concerned with formatting and
    displaying test results.

    Since there are fewer use cases for customizing TestSuite than TestRunner,
    implementing parallelization at the level of the TestSuite improves
    interoperability with existing custom test runners. A single instance of a
    test runner can still collect results from all tests without being aware
    that they have been run in parallel.
    """

    # In case someone wants to modify these in a subclass.
    init_worker = _init_worker
    run_subsuite = _run_subsuite
    runner_class = RemoteTestRunner

    def __init__(self, suite, processes, failfast=False):
        self.subsuites = partition_suite_by_case(suite)
        self.processes = processes
        self.failfast = failfast
        super().__init__()

    def run(self, result):
        """
        Distribute test cases across workers.

        Return an identifier of each test case with its result in order to use
        imap_unordered to show results as soon as they're available.

        To minimize pickling errors when getting results from workers:

        - pass back numeric indexes in self.subsuites instead of tests
        - make tracebacks picklable with tblib, if available

        Even with tblib, errors may still occur for dynamically created
        exception classes which cannot be unpickled.
        """
        counter = multiprocessing.Value(ctypes.c_int, 0)
       # can get here
        breakpoint()
        pool = multiprocessing.Pool(
            processes=self.processes,
            initializer=self.init_worker.__func__,
            initargs=[counter],
        )
        # not getting here
        breakpoint()

The modified _init_worker:

def _init_worker(counter):
    """
    Switch to databases dedicated to this worker.

    This helper lives at module-level because of the multiprocessing module's
    requirements.
    """

    global _worker_id
    print(f"global _worker_id: {_worker_id}")
    with counter.get_lock():
        counter.value += 1
        _worker_id = counter.value
    print(f"_worker_id after get_lock: {_worker_id}")
    print(f"connections: {connections}")

    for alias in connections:
        print(f"alias: {alias}")
        connection = connections[alias]
        print(f"connection: {connection}")
        settings_dict = connection.creation.get_test_db_clone_settings(str(_worker_id))
        print(f"settings_dict: {settings_dict}")
        # connection.settings_dict must be updated in place for changes to be
        # reflected in django.db.connections. If the following line assigned
        # connection.settings_dict = settings_dict, new threads would connect
        # to the default database instead of the appropriate clone.
        connection.settings_dict.update(settings_dict)
        print(f"settings_dict updated")
        print(f"connection.close {connection.close}")
        print(dir(connection.close))
        connection.close()
        print(f"connection closed")

Output:

_worker_id after get_lock: 13
connections: <django.db.utils.ConnectionHandler object at 0x7f30e5f42f70>
alias: default
connection: <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f30e3be0a30>
settings_dict: {'NAME': 'test_circus_13', 'USER': 'circus', 'PASSWORD': 'password', 'HOST': 'localhost', 'PORT': 5432, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'DISABLE_SERVER_SIDE_CURSORS': True, 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'OPTIONS': {}, 'TIME_ZONE': None, 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}}
settings_dict updated
connection.close <bound method BaseDatabaseWrapper.close of <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f30e3be0a30>>
['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__func__', '__ge__', '__get__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__wrapped__']
connection closed
alias: read_only
connection: <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f30e0f361c0>
settings_dict: {'NAME': 'test_circus_13', 'USER': 'circus', 'PASSWORD': 'password', 'HOST': 'localhost', 'PORT': 5432, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'OPTIONS': {}, 'TIME_ZONE': None, 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}}
settings_dict updated
connection.close <bound method BaseDatabaseWrapper.close of <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f30e0f361c0>>
['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__func__', '__ge__', '__get__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__wrapped__']
connection closed
global _worker_id: 0
_worker_id after get_lock: 14
connections: <django.db.utils.ConnectionHandler object at 0x7f30e5f42f70>
alias: default
connection: <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f30e3be0a30>
settings_dict: {'NAME': 'test_circus_14', 'USER': 'circus', 'PASSWORD': 'password', 'HOST': 'localhost', 'PORT': 5432, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'DISABLE_SERVER_SIDE_CURSORS': True, 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'OPTIONS': {}, 'TIME_ZONE': None, 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}}
settings_dict updated
connection.close <bound method BaseDatabaseWrapper.close of <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f30e3be0a30>>
['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__func__', '__ge__', '__get__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__wrapped__']
connection closed
alias: read_only
connection: <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f30e0f361c0>
settings_dict: {'NAME': 'test_circus_14', 'USER': 'circus', 'PASSWORD': 'password', 'HOST': 'localhost', 'PORT': 5432, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'OPTIONS': {}, 'TIME_ZONE': None, 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}}
settings_dict updated
connection.close <bound method BaseDatabaseWrapper.close of <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f30e0f361c0>>
['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__func__', '__ge__', '__get__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__wrapped__']
connection closed
global _worker_id: 0
_worker_id after get_lock: 15
connections: <django.db.utils.ConnectionHandler object at 0x7f30e5f42f70>
alias: default
connection: <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f30e3be0a30>
settings_dict: {'NAME': 'test_circus_15', 'USER': 'circus', 'PASSWORD': 'password', 'HOST': 'localhost', 'PORT': 5432, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'DISABLE_SERVER_SIDE_CURSORS': True, 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'OPTIONS': {}, 'TIME_ZONE': None, 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}}
settings_dict updated
connection.close <bound method BaseDatabaseWrapper.close of <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f30e3be0a30>>
['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__func__', '__ge__', '__get__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__wrapped__']
connection closed
alias: read_only
connection: <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f30e0f361c0>
settings_dict: {'NAME': 'test_circus_15', 'USER': 'circus', 'PASSWORD': 'password', 'HOST': 'localhost', 'PORT': 5432, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'OPTIONS': {}, 'TIME_ZONE': None, 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}}
settings_dict updated
connection.close <bound method BaseDatabaseWrapper.close of <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f30e0f361c0>>
['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__func__', '__ge__', '__get__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__wrapped__']
connection closed
global _worker_id: 0
_worker_id after get_lock: 16
connections: <django.db.utils.ConnectionHandler object at 0x7f30e5f42f70>
alias: default
connection: <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f30e3be0a30>
settings_dict: {'NAME': 'test_circus_16', 'USER': 'circus', 'PASSWORD': 'password', 'HOST': 'localhost', 'PORT': 5432, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'DISABLE_SERVER_SIDE_CURSORS': True, 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'OPTIONS': {}, 'TIME_ZONE': None, 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}}
settings_dict updated
connection.close <bound method BaseDatabaseWrapper.close of <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f30e3be0a30>>
['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__func__', '__ge__', '__get__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__wrapped__']
connection closed
alias: read_only
connection: <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f30e0f361c0>
settings_dict: {'NAME': 'test_circus_16', 'USER': 'circus', 'PASSWORD': 'password', 'HOST': 'localhost', 'PORT': 5432, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'OPTIONS': {}, 'TIME_ZONE': None, 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}}
settings_dict updated
connection.close <bound method BaseDatabaseWrapper.close of <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7f30e0f361c0>>
['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__func__', '__ge__', '__get__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__wrapped__']
connection closed

I also tried running the following:

sudo strace -p $(ps aux | grep python | awk '{ print $2"," }' | tr -d '\n')

with the following output:

[pid 985147] getpid()                   = 158
[pid 985147] epoll_wait(4,  <unfinished ...>
[pid 982256] <... poll resumed>)        = 0 (Timeout)
[pid 982256] wait4(-1, 0x7ffc96be325c, WNOHANG, NULL) = 0
[pid 982256] poll([{fd=6, events=POLLIN|POLLPRI|POLLHUP}, {fd=8, events=POLLIN|POLLPRI|POLLHUP}, {fd=9, events=POLLIN|POLLPRI|POLLHUP}, {fd=13, events=POLLIN|POLLPRI|POLLHUP}, {fd=14, events=POLLIN|POLLPRI|POLLHUP}, {fd=18, events=POLLIN|POLLPRI|POLLHUP}, {fd=19, events=POLLIN|POLLPRI|POLLHUP}], 7, 1000 <unfinished ...>
[pid 979822] <... futex resumed>)       = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678471, tv_nsec=423823746}, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 982254] <... poll resumed>)        = 0 (Timeout)
[pid 982254] wait4(-1, 0x7ffcdd48638c, WNOHANG, NULL) = 0
[pid 982254] poll([{fd=6, events=POLLIN|POLLPRI|POLLHUP}, {fd=8, events=POLLIN|POLLPRI|POLLHUP}, {fd=9, events=POLLIN|POLLPRI|POLLHUP}, {fd=13, events=POLLIN|POLLPRI|POLLHUP}, {fd=14, events=POLLIN|POLLPRI|POLLHUP}, {fd=18, events=POLLIN|POLLPRI|POLLHUP}, {fd=19, events=POLLIN|POLLPRI|POLLHUP}], 7, 1000 <unfinished ...>
[pid 979822] <... futex resumed>)       = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678471, tv_nsec=524078208}, FUTEX_BITSET_MATCH_ANY) = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678471, tv_nsec=624362319}, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 982249] <... poll resumed>)        = 0 (Timeout)
[pid 982249] wait4(-1, 0x7ffe2bd77fcc, WNOHANG, NULL) = 0
[pid 982249] poll([{fd=6, events=POLLIN|POLLPRI|POLLHUP}, {fd=8, events=POLLIN|POLLPRI|POLLHUP}, {fd=9, events=POLLIN|POLLPRI|POLLHUP}, {fd=13, events=POLLIN|POLLPRI|POLLHUP}, {fd=14, events=POLLIN|POLLPRI|POLLHUP}, {fd=18, events=POLLIN|POLLPRI|POLLHUP}, {fd=19, events=POLLIN|POLLPRI|POLLHUP}], 7, 1000 <unfinished ...>
[pid 979822] <... futex resumed>)       = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678471, tv_nsec=724715131}, FUTEX_BITSET_MATCH_ANY) = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678471, tv_nsec=825005903}, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 983968] <... select resumed>)      = 0 (Timeout)
[pid 983968] select(4, [3], [], [], {tv_sec=1, tv_usec=0} <unfinished ...>
[pid 983964] <... select resumed>)      = 0 (Timeout)
[pid 983964] select(4, [3], [], [], {tv_sec=1, tv_usec=0} <unfinished ...>
[pid 979822] <... futex resumed>)       = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678471, tv_nsec=925222087}, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 984141] <... select resumed>)      = 0 (Timeout)
[pid 984141] select(4, [3], [], [], {tv_sec=1, tv_usec=0} <unfinished ...>
[pid 979822] <... futex resumed>)       = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678472, tv_nsec=25510800}, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 980978] <... poll resumed>)        = 0 (Timeout)
[pid 980978] wait4(-1, 0x7ffe132a570c, WNOHANG, NULL) = 0
[pid 980978] poll([{fd=6, events=POLLIN|POLLPRI|POLLHUP}], 1, 1000 <unfinished ...>
[pid 979822] <... futex resumed>)       = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678472, tv_nsec=125792844}, FUTEX_BITSET_MATCH_ANY) = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678472, tv_nsec=226127602}, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 985147] <... epoll_wait resumed>[], 64, 884) = 0
[pid 985147] recvfrom(10, 0x7f6359ccd590, 7, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
[pid 985147] getpid()                   = 158
[pid 985147] epoll_wait(4,  <unfinished ...>
[pid 979822] <... futex resumed>)       = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678472, tv_nsec=326490686}, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 982256] <... poll resumed>)        = 0 (Timeout)
[pid 982256] wait4(-1, 0x7ffc96be325c, WNOHANG, NULL) = 0
[pid 982256] poll([{fd=6, events=POLLIN|POLLPRI|POLLHUP}, {fd=8, events=POLLIN|POLLPRI|POLLHUP}, {fd=9, events=POLLIN|POLLPRI|POLLHUP}, {fd=13, events=POLLIN|POLLPRI|POLLHUP}, {fd=14, events=POLLIN|POLLPRI|POLLHUP}, {fd=18, events=POLLIN|POLLPRI|POLLHUP}, {fd=19, events=POLLIN|POLLPRI|POLLHUP}], 7, 1000 <unfinished ...>
[pid 979822] <... futex resumed>)       = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678472, tv_nsec=426696798}, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 982254] <... poll resumed>)        = 0 (Timeout)
[pid 982254] wait4(-1, 0x7ffcdd48638c, WNOHANG, NULL) = 0
[pid 982254] poll([{fd=6, events=POLLIN|POLLPRI|POLLHUP}, {fd=8, events=POLLIN|POLLPRI|POLLHUP}, {fd=9, events=POLLIN|POLLPRI|POLLHUP}, {fd=13, events=POLLIN|POLLPRI|POLLHUP}, {fd=14, events=POLLIN|POLLPRI|POLLHUP}, {fd=18, events=POLLIN|POLLPRI|POLLHUP}, {fd=19, events=POLLIN|POLLPRI|POLLHUP}], 7, 1000 <unfinished ...>
[pid 979822] <... futex resumed>)       = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678472, tv_nsec=527065712}, FUTEX_BITSET_MATCH_ANY) = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678472, tv_nsec=627329650}, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 982249] <... poll resumed>)        = 0 (Timeout)
[pid 982249] wait4(-1, 0x7ffe2bd77fcc, WNOHANG, NULL) = 0
[pid 982249] poll([{fd=6, events=POLLIN|POLLPRI|POLLHUP}, {fd=8, events=POLLIN|POLLPRI|POLLHUP}, {fd=9, events=POLLIN|POLLPRI|POLLHUP}, {fd=13, events=POLLIN|POLLPRI|POLLHUP}, {fd=14, events=POLLIN|POLLPRI|POLLHUP}, {fd=18, events=POLLIN|POLLPRI|POLLHUP}, {fd=19, events=POLLIN|POLLPRI|POLLHUP}], 7, 1000 <unfinished ...>
[pid 979822] <... futex resumed>)       = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678472, tv_nsec=727727563}, FUTEX_BITSET_MATCH_ANY) = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678472, tv_nsec=828072068}, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 983968] <... select resumed>)      = 0 (Timeout)
[pid 983968] select(4, [3], [], [], {tv_sec=1, tv_usec=0} <unfinished ...>
[pid 983964] <... select resumed>)      = 0 (Timeout)
[pid 983964] select(4, [3], [], [], {tv_sec=1, tv_usec=0} <unfinished ...>
[pid 979822] <... futex resumed>)       = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678472, tv_nsec=928364688}, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 984141] <... select resumed>)      = 0 (Timeout)
[pid 984141] select(4, [3], [], [], {tv_sec=1, tv_usec=0} <unfinished ...>
[pid 979822] <... futex resumed>)       = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678473, tv_nsec=28646167}, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 967405] <... restart_syscall resumed>) = 1
[pid 967405] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="U\2\273\0\371\254p(\3\24\4\0\20\0\0\0\0\0\0\24\24\24\24\24\0\0\3\37%\2\0\0", iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 32
[pid 967405] recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 967405] recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 967405] recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 967405] recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
[pid 967405] poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=13, events=POLLIN}], 6, -1 <unfinished ...>
[pid 980978] <... poll resumed>)        = 0 (Timeout)
[pid 980978] wait4(-1, 0x7ffe132a570c, WNOHANG, NULL) = 0
[pid 980978] poll([{fd=6, events=POLLIN|POLLPRI|POLLHUP}], 1, 1000 <unfinished ...>
[pid 979822] <... futex resumed>)       = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678473, tv_nsec=128992530}, FUTEX_BITSET_MATCH_ANY) = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678473, tv_nsec=229221571}, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 985147] <... epoll_wait resumed>[], 64, 1000) = 0
[pid 985147] recvfrom(10, 0x7f6359ccd590, 7, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
[pid 985147] getpid()                   = 158
[pid 985147] epoll_wait(4,  <unfinished ...>
[pid 979822] <... futex resumed>)       = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678473, tv_nsec=329462511}, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 985147] <... epoll_wait resumed>[], 64, 112) = 0
[pid 985147] openat(AT_FDCWD, "/proc/loadavg", O_RDONLY) = 11
[pid 985147] read(11, "0.28 0.56 0.66 3/3660 160\n", 64) = 26
[pid 985147] close(11)                  = 0
[pid 985147] recvfrom(8, 0x7f635044db90, 7, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
[pid 985147] getsockopt(8, SOL_SOCKET, SO_SNDBUF, [87040], [4]) = 0
[pid 985147] sendto(8, "\1\0\1\0\0\0!\0<\0(\0\0\10celeryev\20worker.he"..., 409, 0, NULL, 0) = 409
[pid 985147] getpid()                   = 158
[pid 985147] epoll_wait(4, [], 64, 0)   = 0
[pid 985147] recvfrom(7, 0x7f635044d9b0, 7, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
[pid 985147] getpid()                   = 158
[pid 985147] epoll_wait(4, [{EPOLLIN, {u32=7, u64=21474836487}}], 64, 887) = 1
[pid 985147] recvfrom(7, "\1\0\2\0\0\0-", 7, 0, NULL, NULL) = 7
[pid 985147] recvfrom(7, "\0<\0<\5None2\0\0\0\0\0\0\"\344\0\10celeryev\20wor"..., 45, 0, NULL, NULL) = 45
[pid 985147] recvfrom(7, "\316", 1, 0, NULL, NULL) = 1
[pid 985147] recvfrom(7, "\2\0\2\0\0\0L", 7, 0, NULL, NULL) = 7
[pid 985147] recvfrom(7, "\0<\0\0\0\0\0\0\0\0\1\24\370\0\20application/json\5"..., 76, 0, NULL, NULL) = 76
[pid 985147] recvfrom(7, "\316", 1, 0, NULL, NULL) = 1
[pid 985147] recvfrom(7, "\3\0\2\0\0\1\24", 7, 0, NULL, NULL) = 7
[pid 985147] recvfrom(7, "{\"hostname\": \"celery@339facfd329"..., 276, 0, NULL, NULL) = 276
[pid 985147] recvfrom(7, "\316", 1, 0, NULL, NULL) = 1
[pid 985147] recvfrom(7, 0x7f635044d230, 7, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
[pid 985147] getpid()                   = 158
[pid 985147] epoll_wait(4,  <unfinished ...>
[pid 982256] <... poll resumed>)        = 0 (Timeout)
[pid 982256] wait4(-1, 0x7ffc96be325c, WNOHANG, NULL) = 0
[pid 982256] poll([{fd=6, events=POLLIN|POLLPRI|POLLHUP}, {fd=8, events=POLLIN|POLLPRI|POLLHUP}, {fd=9, events=POLLIN|POLLPRI|POLLHUP}, {fd=13, events=POLLIN|POLLPRI|POLLHUP}, {fd=14, events=POLLIN|POLLPRI|POLLHUP}, {fd=18, events=POLLIN|POLLPRI|POLLHUP}, {fd=19, events=POLLIN|POLLPRI|POLLHUP}], 7, 1000 <unfinished ...>
[pid 979822] <... futex resumed>)       = -1 ETIMEDOUT (Connection timed out)
[pid 979822] futex(0x56126d175400, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=678473, tv_nsec=429647821}, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 982254] <... poll resumed>)        = 0 (Timeout)
[pid 982254] wait4(-1, 0x7ffcdd48638c, WNOHANG, NULL) = 0
[pid 982254] poll([{fd=6, events=POLLIN|POLLPRI|POLLHUP}, {fd=8, events=POLLIN|POLLPRI|POLLHUP}, {fd=9, events=POLLIN|POLLPRI|POLLHUP}, {fd=13, events=POLLIN|POLLPRI|POLLHUP}, {fd=14, events=POLLIN|POLLPRI|POLLHUP}, {fd=18, events=POLLIN|POLLPRI|POLLHUP}, {fd=19, events=POLLIN|POLLPRI|POLLHUP}], 7, 1000^Cstrace: Process 1696 detached
strace: Process 2157 detached
strace: Process 967405 detached
strace: Process 979822 detached
strace: Process 980978 detached
strace: Process 982249 detached
strace: Process 982254 detached
 <detached ...>
strace: Process 982256 detached
strace: Process 983964 detached
strace: Process 983968 detached
strace: Process 984141 detached
strace: Process 985147 detached
strace: Process 1009076 detached
strace: Process 1009130 detached
strace: Process 1009131 detached
strace: Process 1009132 detached
strace: Process 1009133 detached
strace: Process 1009134 detached
strace: Process 1009135 detached
strace: Process 1009136 detached
strace: Process 1009137 detached
strace: Process 1009138 detached
strace: Process 1009139 detached
strace: Process 1009140 detached
strace: Process 1009141 detached
strace: Process 1009142 detached
strace: Process 1009143 detached
strace: Process 1009144 detached
strace: Process 1009145 detached

Also related:

Using existing clone for alias 'default' ('test_circus')...
System check identified no issues (0 silenced).
> /home/jm/pycharm_projects/circus/venv_3_9_10/lib/python3.9/site-packages/django/test/runner.py(404)run()
-> pool = multiprocessing.Pool(
(Pdb) s
> /home/jm/pycharm_projects/circus/venv_3_9_10/lib/python3.9/site-packages/django/test/runner.py(405)run()
-> processes=self.processes,
(Pdb) n
> /home/jm/pycharm_projects/circus/venv_3_9_10/lib/python3.9/site-packages/django/test/runner.py(406)run()
-> initializer=self.init_worker.__func__,
(Pdb) n
> /home/jm/pycharm_projects/circus/venv_3_9_10/lib/python3.9/site-packages/django/test/runner.py(407)run()
-> initargs=[counter],
(Pdb) n
> /home/jm/pycharm_projects/circus/venv_3_9_10/lib/python3.9/site-packages/django/test/runner.py(404)run()
-> pool = multiprocessing.Pool(
(Pdb) s
--Call--
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/context.py(115)Pool()
-> def Pool(self, processes=None, initializer=None, initargs=(),
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/context.py(118)Pool()
-> from .pool import Pool
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/context.py(119)Pool()
-> return Pool(processes, initializer, initargs, maxtasksperchild,
(Pdb) s
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/context.py(120)Pool()
-> context=self.get_context())
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/context.py(119)Pool()
-> return Pool(processes, initializer, initargs, maxtasksperchild,
(Pdb) s
--Call--
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(183)__init__()
-> def __init__(self, processes=None, initializer=None, initargs=(),
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(187)__init__()
-> self._pool = []
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(188)__init__()
-> self._state = INIT
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(190)__init__()
-> self._ctx = context or get_context()
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(191)__init__()
-> self._setup_queues()
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(192)__init__()
-> self._taskqueue = queue.SimpleQueue()
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(196)__init__()
-> self._change_notifier = self._ctx.SimpleQueue()
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(197)__init__()
-> self._cache = _PoolCache(notifier=self._change_notifier)
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(198)__init__()
-> self._maxtasksperchild = maxtasksperchild
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(199)__init__()
-> self._initializer = initializer
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(200)__init__()
-> self._initargs = initargs
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(202)__init__()
-> if processes is None:
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(204)__init__()
-> if processes < 1:
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(207)__init__()
-> if initializer is not None and not callable(initializer):
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(210)__init__()
-> self._processes = processes
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(211)__init__()
-> try:
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(212)__init__()
-> self._repopulate_pool()
(Pdb) s
--Call--
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(302)_repopulate_pool()
-> def _repopulate_pool(self):
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(303)_repopulate_pool()
-> return self._repopulate_pool_static(self._ctx, self.Process,
(Pdb) self._ctx
<multiprocessing.context.ForkContext object at 0x7feefa426670>
(Pdb) l
298  	                cleaned = True
299  	                del pool[i]
300  	        return cleaned
301  	
302  	    def _repopulate_pool(self):
303  ->	        return self._repopulate_pool_static(self._ctx, self.Process,
304  	                                            self._processes,
305  	                                            self._pool, self._inqueue,
306  	                                            self._outqueue, self._initializer,
307  	                                            self._initargs,
308  	                                            self._maxtasksperchild,
(Pdb) self._processes
16
(Pdb) self._pool
[]
(Pdb) self._initializer
<function _init_worker at 0x7feef2884310>
(Pdb) self._initargs
[<Synchronized wrapper for c_int(0)>]
(Pdb) self._maxtasksperchild
(Pdb) s
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(304)_repopulate_pool()
-> self._processes,
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(305)_repopulate_pool()
-> self._pool, self._inqueue,
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(306)_repopulate_pool()
-> self._outqueue, self._initializer,
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(307)_repopulate_pool()
-> self._initargs,
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(308)_repopulate_pool()
-> self._maxtasksperchild,
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(309)_repopulate_pool()
-> self._wrap_exception)
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(303)_repopulate_pool()
-> return self._repopulate_pool_static(self._ctx, self.Process,
(Pdb) s
--Call--
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(311)_repopulate_pool_static()
-> @staticmethod
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(318)_repopulate_pool_static()
-> for i in range(processes - len(pool)):
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(319)_repopulate_pool_static()
-> w = Process(ctx, target=worker,
(Pdb) l
314  	                                maxtasksperchild, wrap_exception):
315  	        """Bring the number of pool processes up to the specified number,
316  	        for use after reaping workers which have exited.
317  	        """
318  	        for i in range(processes - len(pool)):
319  ->	            w = Process(ctx, target=worker,
320  	                        args=(inqueue, outqueue,
321  	                              initializer,
322  	                              initargs, maxtasksperchild,
323  	                              wrap_exception))
324  	            w.name = w.name.replace('Process', 'PoolWorker')
(Pdb) worker
<function worker at 0x7feee0e0e940>
(Pdb) inqueue
<multiprocessing.queues.SimpleQueue object at 0x7feee14c5280>
(Pdb) initargs
[<Synchronized wrapper for c_int(0)>]
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(320)_repopulate_pool_static()
-> args=(inqueue, outqueue,
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(321)_repopulate_pool_static()
-> initializer,
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(322)_repopulate_pool_static()
-> initargs, maxtasksperchild,
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(323)_repopulate_pool_static()
-> wrap_exception))
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(320)_repopulate_pool_static()
-> args=(inqueue, outqueue,
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(319)_repopulate_pool_static()
-> w = Process(ctx, target=worker,
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(324)_repopulate_pool_static()
-> w.name = w.name.replace('Process', 'PoolWorker')
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(325)_repopulate_pool_static()
-> w.daemon = True
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(326)_repopulate_pool_static()
-> w.start()
(Pdb) print(w)
<ForkProcess name='ForkPoolWorker-1' parent=1010291 initial daemon>
(Pdb) w
  /home/jm/pycharm_projects/circus/manage.py(23)<module>()
-> execute_from_command_line(sys.argv)
  /home/jm/pycharm_projects/circus/venv_3_9_10/lib/python3.9/site-packages/django/core/management/__init__.py(419)execute_from_command_line()
-> utility.execute()
  /home/jm/pycharm_projects/circus/venv_3_9_10/lib/python3.9/site-packages/django/core/management/__init__.py(413)execute()
-> self.fetch_command(subcommand).run_from_argv(self.argv)
  /home/jm/pycharm_projects/circus/venv_3_9_10/lib/python3.9/site-packages/django/core/management/commands/test.py(23)run_from_argv()
-> super().run_from_argv(argv)
  /home/jm/pycharm_projects/circus/venv_3_9_10/lib/python3.9/site-packages/django/core/management/base.py(354)run_from_argv()
-> self.execute(*args, **cmd_options)
  /home/jm/pycharm_projects/circus/venv_3_9_10/lib/python3.9/site-packages/django/core/management/base.py(398)execute()
-> output = self.handle(*args, **options)
  /home/jm/pycharm_projects/circus/venv_3_9_10/lib/python3.9/site-packages/django/core/management/commands/test.py(55)handle()
-> failures = test_runner.run_tests(test_labels)
  /home/jm/pycharm_projects/circus/venv_3_9_10/lib/python3.9/site-packages/django/test/runner.py(739)run_tests()
-> result = self.run_suite(suite)
  /home/jm/pycharm_projects/circus/venv_3_9_10/lib/python3.9/site-packages/django/test/runner.py(680)run_suite()
-> return runner.run(suite)
  /home/jm/.pyenv/versions/3.9.10/lib/python3.9/unittest/runner.py(184)run()
-> test(result)
  /home/jm/.pyenv/versions/3.9.10/lib/python3.9/unittest/suite.py(84)__call__()
-> return self.run(*args, **kwds)
  /home/jm/pycharm_projects/circus/venv_3_9_10/lib/python3.9/site-packages/django/test/runner.py(404)run()
-> pool = multiprocessing.Pool(
  /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/context.py(119)Pool()
-> return Pool(processes, initializer, initargs, maxtasksperchild,
  /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(212)__init__()
-> self._repopulate_pool()
  /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(303)_repopulate_pool()
-> return self._repopulate_pool_static(self._ctx, self.Process,
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(326)_repopulate_pool_static()
-> w.start()
(Pdb) n
> /home/jm/.pyenv/versions/3.9.10/lib/python3.9/multiprocessing/pool.py(327)_repopulate_pool_static()
-> pool.append(w)
(Pdb) global _worker_id: 0
_worker_id after get_lock: 1
connections: <django.db.utils.ConnectionHandler object at 0x7feefa613cd0>
alias: default
connection: <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7feef82b0a60>
settings_dict: {'NAME': 'test_circus_1', 'USER': 'circus', 'PASSWORD': 'password', 'HOST': 'localhost', 'PORT': 5432, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'DISABLE_SERVER_SIDE_CURSORS': True, 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'OPTIONS': {}, 'TIME_ZONE': None, 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}}
settings_dict updated
connection.close <bound method BaseDatabaseWrapper.close of <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7feef82b0a60>>
['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__func__', '__ge__', '__get__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__wrapped__']
connection closed
alias: read_only
connection: <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7feef56071c0>
settings_dict: {'NAME': 'test_circus_1', 'USER': 'circus', 'PASSWORD': 'password', 'HOST': 'localhost', 'PORT': 5432, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'OPTIONS': {}, 'TIME_ZONE': None, 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}}
settings_dict updated
connection.close <bound method BaseDatabaseWrapper.close of <django.db.backends.postgresql.base.DatabaseWrapper object at 0x7feef56071c0>>
['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__func__', '__ge__', '__get__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__wrapped__']
connection closed


# Just hangs here

Hi @allen-munsch.

Are you able to put together a reproduce for this? (A test project, exact setup etc.) \

Is it consistent? Are you able to narrow it to a specific test?

  • django 3.2

I can’t recall a specific change there that might cause this. Does it work with earlier/later versions of Django?

1 Like

Thank you for taking a look and making the suggestion of creating a repro.

It appears to be an issue with gevent Pool Popen forking

Setup a repro case, and was eventually able to isolate the issue to gevent

I commented out the monkey patching, and it worked like a charm:

    try:
        from gevent import monkey
        monkey.patch_all()
    except ImportError:
        pass
1 Like

Super. Glad you found the way forward! :+1:

1 Like