You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Worker processes log nothing under the forkserver start method (Python 3.14 default on Linux) #685
On Python 3.14, multiprocessing on Linux defaults to the forkserver start method instead of fork. Under forkserver, taskiq worker subprocesses keep working, but none of their log
records are emitted: no Listening started., no Importing tasks from module …, no shutdown
messages. Warnings and errors still reach stderr through Python's last-resort handler, so the
problem is easy to miss. It breaks any readiness check that waits for Listening started..
Cause
start_listen() in taskiq/cli/worker/run.py reconfigures logging in the child only for spawn
(line 89 on master at 8a1b04d):
A fork child inherits the parent's logging.basicConfig. A forkserver child starts from a
fresh interpreter, like a spawn child, so it inherits nothing and ends up with no handler at
all.
Reproduction
taskiq 0.12.6, Python 3.14.7, Linux x86_64. No external services are needed.
repro_broker.py:
importasynciofromcollections.abcimportAsyncGeneratorfromtaskiqimportAsyncBroker, BrokerMessageclassIdleBroker(AsyncBroker):
"""Minimal broker: receives nothing, just keeps the worker listening."""asyncdefkick(self, message: BrokerMessage) ->None:
passasyncdeflisten(self) ->AsyncGenerator[bytes, None]:
# print(), not logging: proves the worker process is alive and listening.print("IdleBroker.listen() reached", flush=True)
whileTrue:
awaitasyncio.sleep(3600)
yieldb""broker=IdleBroker()
run_cli.py runs the CLI after optionally forcing a start method:
The child already receives args through kwargs={"args": self.args}, so --log-level, --log-format and --no-configure-logging keep working.
Workaround
Until this is fixed, we call logging.basicConfig at import time of the module that holds the
broker. Every worker child imports that module to resolve module:broker. The call is guarded by multiprocessing.parent_process() is not None and multiprocessing.get_start_method() == "forkserver".
Activity
fix(worker): configure logging in forkserver worker processes (taskiq…