-
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 extension prevents PHP execution #31772
Comments
grpc/grpc#31772 Co-authored-by: Taka Oyama <t-oyama@colopl.co.jp>
We running into this error logging as well. When we have multiple threads trying to do some computation. Piggybacking here as it seems to be the same issue - or happy to open another if needed. What version of gRPC and what language are you using? What operating system (Linux, Windows,...) and version? What runtime / compiler are you using (e.g. python version or version of gcc) What did you do? What did you expect to see? What did you see instead?
Anything else we should know about your project / environment? Our job is here if this is helpful in anyway: https://buildkite.com/ray-project/oss-ci-build-branch/builds/1435#0184e9ed-2010-4a26-a83d-6b3918b006d8 |
hi Grpc team, does this warrant yanking the release? It will cause downstream project hanging on Mac, as manifested in our CI. |
… issue on mac (#30982) With grpcio >= 1.50.0, this PR is included: grpc/grpc@6b95573 Tracking issue on grpc repo: grpc/grpc#31772 And this has caused hanging of tests on mac, leading to multiple flaky tests. E.g. [CI] osx://python/ray/tests:test_reference_counting is failing/flaky on master. #30954 osx://python/ray/tests:test_reconstruction osx://python/ray/tests:test_placement_group
This is temporary to workaround grpc/grpc#31772.
May I ask how can I reproduce this? Reason I am asking is we have tests running on the Also, did this work in any previous release? Was it only 1.51.1 + fpm that breaks? [Edit: looks like 1.49.0 is fine?] Edit: Does this has to do with |
I have the same error since december 7. PHP 8.1.13 downgrated to 1.49.0 solves that issue, but getting random Note: had some |
This happens both with php-fpm and with CLI. Hard to say if it's We're running these:
|
@donis So what's the symptom? You run a PHP script either from CLI or from FPM. When does the hang happen? Does it enter your script at all? Or it hangs after your script finished? When it hangs, does it hang forever? As of now we still need a reproducible test case to debug this further. [Edit: shout out to the 12 persons who thumbs up this issue, if any of you can let me know how to reproduce this, will be greatly appreciated] |
One thing to try, you might need to add these 2 lines to your
https://github.com/grpc/grpc/tree/master/src/php#pcntl_fork-support I am suspecting something else in your environment is calling |
we got a process (php-cli) stuck for 3 days with 1.51.1, and no issue with 1.45.0
after downgrade:
so the issue might not depend on these parameters |
@kenji21 But can you verify that if you were to add those |
We have been seeing this on google-cloud-php as well. To reproduce drop the version requirement for the extension: |
I also briefly looked at the commit introduced the behavior change; one behavior difference is after the change, we will continue execute the callbacks after calling ThreadPool.PreFork, where as previously we ignore the remaining callbacks. I suspect this could be the cause of this hanging issue. |
We captured a deadlock stacktraces using the repro script (#31885) https://gist.github.com/scv119/578eaf822c8cffcbbd0045a5eab02e50 It shows two threads deadlocked: ThreadPool thread stacktrace: it's waiting for all worker threads stopped before finish forking.
Worker thread stacktrace: it's waiting for fork to finish before bumping the counter in the ExcCtx.
This might explain why it's hard to reproduce: you need to run a callback (thus creating the ExcCtx) exactly when the fork happens to reproduce this bug. |
This is temporary to workaround grpc/grpc#31772.
I have tried this workaround, but the results did not change. grpc: 1.51.1 |
I also tried the two INI option workarounds, separately & together, and the problem still occurred. |
Bump... why is this not being treated with more urgency? The py fork epoll support seems to have been fixed but no updates on the same problem on PHP side. |
Can we get an update on this? We are still pinned to |
bump |
I can confirm these issues have been fixed in |
@bshaffer thanks for sharing! Did you also check whether the issues have stayed fixed in later versions such as |
I haven't tested in later versions, no, but I would think that the chance of a regression in a minor version is slim. |
@valenciaed thanks for reporting this. Have you tried using |
bump |
FWIW. We use gRPC extensively and have not had any hangs with 1.56.0. $ php -v
PHP 8.1.21 (cli) (built: Jul 10 2023 23:04:11) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.21, Copyright (c) Zend Technologies
with Zend OPcache v8.1.21, Copyright (c), by Zend Technologies
$ php -i | grep grpc
/usr/local/etc/php/conf.d/docker-php-ext-grpc.ini,
grpc
grpc support => enabled
grpc module version => 1.56.0
grpc.enable_fork_support => 0 => 0
grpc.grpc_trace => no value => no value
grpc.grpc_verbosity => no value => no value
grpc.log_filename => no value => no value
grpc.poll_strategy => no value => no value
$ php artisan inspire
Very little is needed to make a happy life. - Marcus Aurelius
$ |
is it possible to be related to the python issue and deadlock explained here: #34672 (comment) ? |
I don't think this root cause would be because of the same refactor PR behind #34672 - that change is significantly newer than this issue |
To whom it may concern: we haven't seen this resurface since we upgraded to 1.58, it's been ~2 months. |
There are still issues with this, PHP 8.3.1, We use
|
We worked around this long ago by adding a <?php
return [
'usePcntl' => false, // Must be false to prevent hanging tinker when Pub/Sub is enabled.
]; |
Is there a reason that fork support still can't be enabled by default? |
We are also encountering this issue with Laravel Horizon jobs (PHP CLI). Fork support does not seem to help. |
Update: apparently all I needed to do to fix my issue of php worker processes getting stuck after running gRPC requests for a while is to set a timeout/deadline on the client calls and implement retries on deadlines, I'm not sure why it just hangs otherwise but I think that some requests wait forever if no deadline is set. |
💤 some feedback from the team would be awesome! 🌟 |
ping @stanley-cheung |
What version of gRPC and what language are you using?
grpc 1.51.1
PHP 7.4.33
What operating system (Linux, Windows,...) and version?
Linux
What runtime / compiler are you using (e.g. python version or version of gcc)
Whatever
php:7.4-fpm-buster
docker image is running.What did you do?
Compiled a new gRPC php extension version and when running anything with PHP - we get this error:
What did you expect to see?
normally running PHP process
What did you see instead?
any PHP process hangs with this error message:
E1130 11:14:11.870998498 29 thread_pool.cc:253] Waiting for thread pool to idle before forking
Anything else we should know about your project / environment?
The text was updated successfully, but these errors were encountered: