-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
gRPC poll segfault in subprocess calls #13998
Comments
This may be the same as #13327. |
@alexmv , #13327 has a different callstack and looks different from this issue. @Sakawa,
i.e
So it looks like |
The code calls
Unfortunately not, we've seen this behavior on a single-process single-thread instance and our code doesn't fork anywhere explicitly.
I just went and generated another core dump with grpcio 1.8.4 and got essentially the same stacktrace (line 1037 of
|
Thanks @Sakawa |
I spent some time digging into this, and here's what I believe is happening:
IMO an ideal outcome here would involve:
|
@jboning, Thanks for looking into this! The only scenario where I agree about documenting this clearly. I created an issue: #14055 Now coming back to this issue:
You are right about the code path. The new thread may behave unexpectedly if the parent process (that called the Unfortunately at this point, I can only think of two ways to address this :
|
Another possibility: Have channel/fork/server creation set some global |
Just as a repro case of this:
Reliably segfaults for me when I run with I'd like to go with one of the options mentioned like using grpc with We haven't run other issues as severe as this in our code using 1.6, but since grpc python has never been thread safe, I'm not sure what issues we have just be avoiding by luck. The only issue I see mentioned is deadlocks related to multiprocessing usage. |
Users interested in fork support, please chime in on #15334 |
@ericgribkoff Ping |
Confirmed that this is now fixed with the latest grpcio release by running the repro snippet from #13998 (comment). See #15334 for the master issue tracking the new client-side fork support, although I believe this was largely fixed by an earlier change to core's fork handlers intended to detect this situation. |
Please reply here if there remain any issues with the fork+exec cases discussed here and I can re-open this issue. This should always work, regardless of whether |
Please answer these questions before submitting your issue.
Should this be an issue in the gRPC issue tracker?
Yes
What version of gRPC and what language are you using?
1.8.2, Python
What operating system (Linux, Windows, …) and version?
Linux
What runtime / compiler are you using (e.g. python version or version of gcc)
Python 2.7
What did you do?
We started seeing segfaults in our Dropbox code after upgrading from 1.6.0 to 1.8.2, when subprocess32 calls began intermittently segfaulting. A backtrace extracted from the core dump of a segfault is below:
We also occasionally see
in our logs, although this happens fairly rarely.
What did you expect to see?
No segfault -- expected subprocess command to run normally
What did you see instead?
Segfault
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
Anything else we should know about your project / environment?
The text was updated successfully, but these errors were encountered: