#2181·channels

ChannelsLiveServerTestCase can't be run in parallel

Author: deronnaxCreated Sep 3, 2025Updated Sep 4, 2025

The error:

bash
$ python manage.py test --parallel
[...]
ERROR: setUpClass (tests.chat.test_chat_liveserver.ChatConsumerTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/mathieu/Library/Application Support/pypoetry/python/[email protected]/lib/python3.12/unittest/suite.py", line 166, in _handleClassSetUp
    setUpClass()
  File "/Users/mathieu/Library/Caches/pypoetry/virtualenvs/tarmac-server-HCLVLw_k-py3.12/lib/python3.12/site-packages/channels/testing/live.py", line 77, in setUpClass
    cls._server_process.start()
    ^^^^^^^^^^^^^^^^^
  File "/Users/mathieu/Library/Application Support/pypoetry/python/[email protected]/lib/python3.12/multiprocessing/process.py", line 118, in start
    assert not _current_process._config.get('daemon'), \
    ^^^^^^^^^^^^^^^^^
AssertionError: daemonic processes are not allowed to have children

Somewhat similar to issue #1843. The "solution" - force multiprocessing start method to fork - was removed in #1922. I think forcing fork start method can't be the solution anymore, it's discouraged on macOS, that's why it was changed to spawn in python 3.8. I think the right fix would be to change ChannelsLiveServerTestCase to replicate Django's LiveServerTestCase design: designed to run in a thread. If that suits you, I can start the PR.

Easy to reproduce: just run a django test suite having a ChannelsLiveServerTestCase with --parallel.