-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Python][S3] Segfault when using S3FileSystem in uwsgi #44071
Comments
We have an Lines 65 to 70 in 046e7cb
Does uwsgi call |
It does look like that is called, from the core dump:
This is the line before the pointer free happens. Is it possible the finalize is called twice somehow, resulting in a double free? |
No, this is the libc exit, and it is often too late at this point to finalize S3. Python atexit handlers are called before, in |
Ok, I think I understand what happens. uwsgi finalizes its plugins thanks to a C-level The atexit handler for the Python handler then does call So we have this:
However, at this point, it's already too late, because calling the libc's |
…44090) ### Rationale for this change Leaking S3 structures at shutdown can be better than inducing a segfault because those structures' destructors run too late at process exit. This seems to avoid the crash when run under `uwsgi` in #44071 ### Are these changes tested? Yes. ### Are there any user-facing changes? Hopefully not. * GitHub Issue: #44071 Authored-by: Antoine Pitrou <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
Issue resolved by pull request 44090 |
@lucasmo Ok, I pushed a workaround for it that will be available in 18.0.0. However, do note that this not totally eliminate the risk of crashes at shutdown, due to how uwsgi implements interpreter finalization (see messages above). Unfortunately, uwsgi seems maintenance-only and it's not obvious there will be any change on that front. |
Describe the bug, including details regarding any error messages, version, and platform.
Simply instantiating
S3FileSystem
within a uwsgi container causes a segfault on process exit.Backtrace
Reproducing
I tried this with pyarrow 17.0.0 and 16.1.0. I tried with the minimum versions of each package that didn't have critical CVEs and worked with python 3.11 or 3.12.
In a virtualenv, install
uwsgi==2.0.23
andpyarrow==17.0.0
.Create the following program called
app.py
:Run
uwsgi --http :9090 --wsgi-file app.py
In another shell, run
curl http://localhost:9090/
Press ^C to terminate the uwsgi container (this also happens after the container serves several requests, or if the container sits idle for 15 minutes).
See:
Component(s)
Python
The text was updated successfully, but these errors were encountered: