Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation warning for os.fork on Python 3.12 #3289

Open
elishagreenwald opened this issue Sep 1, 2024 · 2 comments
Open

Deprecation warning for os.fork on Python 3.12 #3289

elishagreenwald opened this issue Sep 1, 2024 · 2 comments

Comments

@elishagreenwald
Copy link

gunicorn version: ==23.0.0
gevent version: pypi ==24.2.1
Python version: 3.12.5
Operating System: Docker image python:3.12.5-bookworm (debian)
Description:
I'm seeing a deprecation warning when running gevent (via gunicorn) on python 3.12.5. It seems this warning was added in python 3.12 (see python/cpython#109767 for more details)

The warning says:

/usr/local/lib/python3.12/site-packages/gevent/os.py:426: DeprecationWarning: This process (pid=17) is multi-threaded, use of fork() may lead to deadlocks in the child.

I found gunicorn makes calls to os.fork here.

I'm happy to provide more details but my question is, is this a known issue and is there anything to worry about?

Thanks!

@pajod
Copy link
Contributor

pajod commented Sep 1, 2024

Until someone comes up with a detectable scenario where the warning is wrong (at which point cPython could just implement that detection..) I am happy to consider each and every pathway to trigger it a bug worthy of, at the very least, improving documentation.

Its not a single case though, some (live python thread in master) imho should be stopped outright by Gunicorn because a clear recommendation of what to do instead can be provided. Other scenarios (fork+exec from arbiter) should at least produce sensible logging, eventually. And then clearly some scenarios were simply no big deal.. at least until free-threaded 3.13.

Please be specific which case you ask about. Ideally: quote a reproducer. At the very least what processes are running and what the sequence is from adding a native thread to triggering the warning from the (gevent-patched) fork() call. I am guessing you preloaded your application for the gevent worker, and your app is pulling in some "let's do funky stuff at import time" extension module?

@elishagreenwald
Copy link
Author

Sorry for the delayed response. It turns out it's coming from ddtrace (datadog tracing) so I reached out to their support. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants