Closed javiermarinros closed 10 months ago
It looks certain methods, like listTasks
, from Google Cloud Tasks library are not working either when PHP GRPC extension is enabled.
Sorry for the late reply and thank you for raising the issue. The above code is working for me with a different setup. Since this issue is really old, could you please confirm its still happening for you? If not, will close by end of week.
I have just tried to enable the GRPC extension on an running AppEngine PHP 8.1 instance, and I got this error for every request:
Request was aborted after waiting too long to attempt to service your request.
So, for now, I will stick to REST transport that has been working just fine for several years.
Interesting, may I ask the google-cloud-php version you are using?
Sure, we are using:
{ "google/cloud-storage": "^v1.33.2", "google/cloud-logging": "^v1.28.1", "google/cloud-tasks": "^v1.13.1", "google/cloud-pubsub": "^v1.46.2", "google/cloud-secret-manager": "^v1.12.2", "google/cloud-translate": "^v1.15.1" }
To try this in AppEngine, I have made the following setup.
runtime: php81
php.ini
extension=grpc.so
extension=protobuf.so
home.php (Used the app code from https://github.com/crazyrov/gcp_appengine_php_demo)
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Google\Cloud\Logging\Logger;
use Google\Cloud\Logging\LoggingClient;
use Google\Cloud\Datastore\DatastoreClient;
LoggingClient::psrBatchLogger(
'app',
[
'clientConfig' => [
'projectId' => 'myProjectId',
'transport' => 'grpc'
]
])->log(Logger::WARNING, 'Message');
echo 'Done';
composer.json
{
"require": {
"google/cloud-datastore": "^1.2",
"google/cloud-logging": "^v1.28.1"
}
}
Result Got the warning in the Google Cloud Logs:
insertId: "myInsertId"
jsonPayload: {
message: "Message"
}
labels: {1}
logName: "projects/myProjectId/logs/app"
receiveTimestamp: "2023-11-04T07:06:15.054059348Z"
resource: {2}
severity: "WARNING"
timestamp: "2023-11-04T07:06:14.682943Z"
trace: "projects/myProjectId/traces/traceId"
}
I am unable to reproduce the 502 issue here!
Hi @javiermarinros, If not reproducible, I will need to close this as it is running in both my Linux and AppEngine.
Hi @ajupazhamayil the test project I created is working fine under PHP 8.1. However, when I activate the "grpc.so" extension in a project in production and with a lot of traffic, I do get the errors I mentioned above.
Could you please provide me a specific traffic level (requests per second or something in the similar lines)? I will try to generate that amount of traffic in my application to replicate the issue.
We have an average of 150-200 request per second
Hi @javiermarinros, I tried with AppEngine for a 200+ request per second and every request came back 200 OK! Seems like the reproduction is hard!
Hi @ajupazhamayil, yes, it is a difficult error to reproduce. As I said, as long as I don't enable the grpc.so
extension in the php.ini
file, all works as expected, so I will stick to that for now.
Besides that, I found out that using Google libraries with the GRPC protocol sometimes breaks UTF encoding with special characters like Emoji, something that with REST doesn't happen.
Thank you for your help.
Thank you for the prompt replies. Will close this bug as not reproducible.
Also, raised a bug to gRPC repo to see if we can get some action on your issue: https://github.com/grpc/grpc/issues/34958
Thank you!
Using Cloud Logging with gRPC transport automatically kills the instance and a 502 Bad Gateway message is shown to the user under AppEngine Standard for PHP 7.4
This log is written:
Steps to reproduce
composer.json
app.yaml
app.php
php.ini
Testing with param
?transport=rest
is working fine,?transport=grpc
fails.