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
DuckDB global state is not fork-safe, causes RuntimeError in multiprocessing child processes #292
When duckdb.connect() is called in a parent process (e.g., a FastAPI/uvicorn server), and a child process is later created via multiprocessing.Process using the default fork start method, calling duckdb.connect() in the child process raises:
RuntimeError: thread::join failed: No such process
or in some cases, depending on timing:
RuntimeError: Invalid argument
This looks like it occurs because fork() copies DuckDB's global state into the child process, where that state is invalid. fork() only duplicates the calling thread— other threads from DuckDB's internal thread pool don't exist in the child, so joining them fails.
It's worth noting that this doesn't seem to affect in memory connections, looks to be specific to motherduck connections
As noted in duckdb/duckdb#13079, we are aware that this is a current limitation. We're not planning to fix this in this version of the extension, but we are currently working on an extension that has no global state and is safe for use with fork, with concurrent.interpreters and with freethreading. It's very experimental still, but we're hoping to showcase something later this year.
Activity
evertlammerts commentedon Feb 5, 2026
As noted in duckdb/duckdb#13079, we are aware that this is a current limitation. We're not planning to fix this in this version of the extension, but we are currently working on an extension that has no global state and is safe for use with fork, with
concurrent.interpretersand with freethreading. It's very experimental still, but we're hoping to showcase something later this year.