Cloud-Firestore throws Maximum Call Stack Size errors on numerous Firestore statements when using GRPC (PHP pecl) library 1.69.0.
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
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
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from googleapis/google-cloud-php
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
googleapis/google-cloud-php#9730 ·
-
type: feature request
Difficulty 1/5 Under an hour Newbie friendliness 75/100
googleapis/google-cloud-php#9716 · 11 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
googleapis/google-cloud-php#9725 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
googleapis/google-cloud-php#9675 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
googleapis/google-cloud-php#9674 · 1 comment ·
All issues in googleapis/google-cloud-php
Similar issues
-
tooling
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
UX
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
ProfessionalWiki/NeoWiki#1525 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
OpenConext/OpenConext-engineblock#2122 ·
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Automattic/safe-publish#594 ·