Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Cloud-Firestore throws Maximum Call Stack Size errors on numerous Firestore statements when using GRPC (PHP pecl) library 1.69.0.

Open
#8,015 9 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
grpc, php
Domain
backend, database

Research direction

Reproduce with PHP 8.3.7, google/cloud-firestore 1.47.3, and GRPC 1.69.0, comparing the working 1.67.0 setup. Start at vendor/google/gax/src/CredentialsWrapper.php:244 and follow the stack through FirestoreGapicClient.php, Connection/Grpc.php, and Query.php; done means identifying whether the regression belongs to this library and recording a verified fix or affected dependency version.

Written by the indexing model from the issue text.

Description

Cloud-Firestore throws Maximum Call Stack Size errors on numerous Firestore statements when using GRPC (PHP pecl) library 1.69.0. This does not consistently happen in the same spot but we have a call that makes a few dozen Firestore calls, and it always fails with this error in one of the calls (which call is inconsistent though).

Reverting back to GRPC 1.67.0 from GRPC 1.69.0 fixes the issue. I don't know if this is an issue with the PHP PECL library GRPC or with this library, but given this library requires GRPC, I am starting by submitting this issue here.

Environment details
  • OS: Docker / Apache on Linux
  • PHP version: 8.3.7
  • Package name and version: google/cloud-firestore version 1.47.3
Steps to reproduce
  1. Execute Numerous Firestore calls while running GRPC 1.69.0

ERROR CALL STACK:

Error: Maximum call stack size of 8339456 bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? in file /var/www/website/backend/vendor/google/gax/src/CredentialsWrapper.php on line 244
Stack trace:
  1. Error->() /var/www/website/backend/vendor/google/gax/src/CredentialsWrapper.php:244
  2. Google\ApiCore\CredentialsWrapper->Google\ApiCore\{closure}() [internal]:0
  3. Grpc\Call->startBatch() /var/www/website/backend/vendor/grpc/grpc/src/lib/ServerStreamingCall.php:43
  4. Grpc\ServerStreamingCall->start() /var/www/website/backend/vendor/grpc/grpc/src/lib/BaseStub.php:368
  5. Grpc\BaseStub->Grpc\{closure}() /var/www/website/backend/vendor/grpc/grpc/src/lib/BaseStub.php:593
  6. Grpc\BaseStub->_serverStreamRequest() /var/www/website/backend/vendor/google/gax/src/Transport/GrpcTransport.php:227
  7. Google\ApiCore\Transport\GrpcTransport->startServerStreamingCall() /var/www/website/backend/vendor/google/gax/src/GapicClientTrait.php:664
  8. Google\Cloud\Firestore\V1\Gapic\FirestoreGapicClient->Google\ApiCore\{closure}() /var/www/website/backend/vendor/google/gax/src/Middleware/CredentialsWrapperMiddleware.php:60
  9. Google\ApiCore\Middleware\CredentialsWrapperMiddleware->__invoke() /var/www/website/backend/vendor/google/gax/src/Middleware/FixedHeaderMiddleware.php:67
 10. Google\ApiCore\Middleware\FixedHeaderMiddleware->__invoke() /var/www/website/backend/vendor/google/gax/src/Middleware/RetryMiddleware.php:94
 11. Google\ApiCore\Middleware\RetryMiddleware->__invoke() /var/www/website/backend/vendor/google/gax/src/Middleware/RequestAutoPopulationMiddleware.php:73
 12. Google\ApiCore\Middleware\RequestAutoPopulationMiddleware->__invoke() /var/www/website/backend/vendor/google/gax/src/Middleware/OptionsFilterMiddleware.php:60
 13. Google\ApiCore\Middleware\OptionsFilterMiddleware->__invoke() /var/www/website/backend/vendor/google/gax/src/GapicClientTrait.php:630
 14. Google\Cloud\Firestore\V1\Gapic\FirestoreGapicClient->startCall() /var/www/website/backend/vendor/google/cloud-firestore/src/V1/Gapic/FirestoreGapicClient.php:1243
 15. Google\Cloud\Firestore\V1\Gapic\FirestoreGapicClient->runQuery() /var/www/website/backend/vendor/google/cloud-core/src/ExponentialBackoff.php:97
 16. call_user_func_array() /var/www/website/backend/vendor/google/cloud-core/src/ExponentialBackoff.php:97
 17. Google\Cloud\Core\ExponentialBackoff->execute() /var/www/website/backend/vendor/google/cloud-core/src/GrpcRequestWrapper.php:134
 18. Google\Cloud\Core\GrpcRequestWrapper->send() /var/www/website/backend/vendor/google/cloud-core/src/GrpcTrait.php:79
 19. Google\Cloud\Firestore\Connection\Grpc->send() /var/www/website/backend/vendor/google/cloud-firestore/src/Connection/Grpc.php:267
 20. Google\Cloud\Firestore\Connection\Grpc->runQuery() /var/www/website/backend/vendor/google/cloud-firestore/src/Query.php:322
 21. Google\Cloud\Firestore\Query->Google\Cloud\Firestore\{closure}() /var/www/website/backend/vendor/google/cloud-core/src/ExponentialBackoff.php:97
 22. call_user_func_array() /var/www/website/backend/vendor/google/cloud-core/src/ExponentialBackoff.php:97
 23. Google\Cloud\Core\ExponentialBackoff->execute() /var/www/website/backend/vendor/google/cloud-firestore/src/Query.php:320
 24. Google\Cloud\Firestore\Query->documents() /var/www/website/..... ORIGINATING CODE

The originating code in question works great with GRPC 1.67.0 but errors in GRPC 1.69.0. Here is the code (cleaned up for clarity):

$firestoreClient = FirestoreDatabase::getInstance()->getFirestoreClient();
$firestoreCollectionDriverSchedule = $firestoreClient->collection(Config::$config['Firebase']['firestoreCollectionId']);
$firestoreSchedules = $firestoreCollectionDriverSchedule->where('date', '=', $date)->where('state', '=', $state);
$documents = $firestoreSchedules->documents();

It errored on the last line of code. As stated, I can run this same request and it will sometimes error on a different firestore statement, but it seems like ALL firestore statements are having this issue, though it may not be the first one.

Note I have not tried anything other than GRPC 1.67.0 (which works) and GRPC 1.69.0 (which does not work). It's quite possible that 1.68.0 would work - I have not tried it.

Dominant language
PHP
Stars
1.2k
Forks
464
Avg merge
2d 2h
Merged PRs (30d)
103

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from googleapis/google-cloud-php

All issues in googleapis/google-cloud-php

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.