| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
The polling thread that refreshes the local evaluation environment document is created in the parent process. Threads do not survive os.fork(), so pre-fork servers (gunicorn, uwsgi, multiprocessing) end up with worker processes whose Python Thread object is intact but whose underlying OS thread is dead. Workers then serve a frozen environment-document snapshot from the moment of fork for their entire lifetime. EnvironmentDataPollingManager now composes a threading.Thread instead of inheriting from it, and registers an os.register_at_fork hook so a fresh polling thread is started in each child. The hook also closes the parent's requests.Session so connection-pool sockets are not shared across processes. Stream and analytics threads are not yet covered; tracking separately.
The pytest-httpserver dev dependency requires python>=3.10. Move the fork test (the only consumer) into its own file so the four pre-existing polling-manager tests still run on 3.9, and skip the new file there via importorskip. Add a mypy override so 3.9 type-checks do not error on the missing module.
| Back | FazBrowse Home | New Git URL |
Closes #77.
The polling thread that refreshes the local evaluation environment document is created in the parent process. Threads do not survive os.fork(), so pre-fork servers (gunicorn, uwsgi, multiprocessing) end up with worker processes whose Python Thread object is intact but whose underlying OS thread is dead. is_alive() correctly reports False, no polls happen, and workers serve a frozen environment-document snapshot from the moment of fork for their entire lifetime.
EnvironmentDataPollingManager now composes a threading.Thread instead of inheriting from it, and registers an os.register_at_fork(after_in_child=...) hook so a fresh polling thread is started in each child. The hook also closes the parent's requests.Session because connection-pool sockets are inherited as shared FDs across fork; reusing them would interleave bytes between processes.
Notes
Test plan
Notes