Google-cloud-php: PubSub - Google\Cloud\Exception\ServiceException: Deadline Exceeded

Created on 10 Jan 2017  路  4Comments  路  Source: googleapis/google-cloud-php

I'm busy testing gRPC support with the PubSub API.

I have the following dependencies installed:

  • gRPC 1.1 PECL extension
  • google/gax 0.6.0 composer package
  • google/proto-client-php 0.6.0 composer package (0.7.0 wouldn't work for me)

This is on PHP 7.0.11.

I'm testing a pull type subscription and keep getting "Deadline Exceeded" exceptions on a timeout.

Fatal error: Uncaught Google\Cloud\Exception\ServiceException: Deadline Exceeded in /opt/php-pubsub/vendor/google/cloud/src/GrpcRequestWrapper.php:188
Stack trace:
#0 /opt/php-pubsub/vendor/google/cloud/src/GrpcRequestWrapper.php(131): Google\Cloud\GrpcRequestWrapper->convertToGoogleException(Object(Google\GAX\ApiException))
#1 /opt/php-pubsub/vendor/google/cloud/src/GrpcTrait.php(63): Google\Cloud\GrpcRequestWrapper->send(Array, Array, Array)
#2 /opt/php-pubsub/vendor/google/cloud/src/PubSub/Connection/Grpc.php(227): Google\Cloud\PubSub\Connection\Grpc->send(Array, Array)
#3 /opt/php-pubsub/vendor/google/cloud/src/PubSub/Subscription.php(356): Google\Cloud\PubSub\Connection\Grpc->pull(Array)
#4 /opt/php-pubsub/src/GoogleCloudPubSubAdapter.php(141): Google\Cloud\PubSub\Subscription->pull()
#5 /opt/php-pubsub/examples/GoogleCloudConsumerExample.php(15): Superbalist\PubSub\GoogleCloud\GoogleCloudPubSubAdapter->subscribe('my_channel', Object(Closure))
#6 {main}
  thrown in /opt/php-pubsub/vendor/google/cloud/src/GrpcRequestWrapper.php on line 188

Is there an option I need to pass for setting the correct timeout?

pubsub gapic triage me bug

Most helpful comment

Hey @matthewgoslett! Apologies for the delay in a response here.

I spent some time looking into this, and it appears that a default timeout of 60 seconds is being applied to pull calls which are run through gRPC.

https://github.com/GoogleCloudPlatform/google-cloud-php/blob/master/src/PubSub/V1/resources/subscriber_client_config.json#L70

You can override this default setting like so:

$messages = $subscription->pull([
    'grpcOptions' => [
        'timeoutMillis' => null
    ]
]);

Please let me know if that helps solve the issue for you. :)

All 4 comments

Can you share the code you're running that is raising this error?

ye sure

It's the superbalist/php-pubsub-google-cloud adapter we maintain - https://github.com/Superbalist/php-pubsub-google-cloud

I've pushed latest changes to master in this commit - https://github.com/Superbalist/php-pubsub-google-cloud/commit/ed1c5203c3fc894e5a3d4c65db9a9f472e6a6668

We have a dockerfile with examples for testing.

  1. Create a json key file at the your-gcloud-key.json in the root of the repo.
  2. make up
  3. In the docker shell, run php examples/GoogleCloudConsumerExample.php

If the consumer runs for long enough without receiving a message, the ServiceException is thrown.

Hey @matthewgoslett! Apologies for the delay in a response here.

I spent some time looking into this, and it appears that a default timeout of 60 seconds is being applied to pull calls which are run through gRPC.

https://github.com/GoogleCloudPlatform/google-cloud-php/blob/master/src/PubSub/V1/resources/subscriber_client_config.json#L70

You can override this default setting like so:

$messages = $subscription->pull([
    'grpcOptions' => [
        'timeoutMillis' => null
    ]
]);

Please let me know if that helps solve the issue for you. :)

I'm going to close this out for now, please feel free to re-open if there are any other concerns.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ammopt picture ammopt  路  6Comments

smalot picture smalot  路  6Comments

highstrike picture highstrike  路  5Comments

joseph1125 picture joseph1125  路  8Comments

Najtmare picture Najtmare  路  6Comments