Skip to content
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

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

Open
BobDankert opened this issue Jan 15, 2025 · 0 comments

Comments

@BobDankert
Copy link

BobDankert commented Jan 15, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant