- Issue created by @tzura
- Merge request !30Issue 3524005: Adding transport options (REST or gRPC). β (Merged) created by tzura
Automatically closed - issue fixed for 2 weeks with no activity.
Periodically running into this error:
The website encountered an unexpected error. Try again later.
_Error_: Maximum call stack size of 10436608 bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? in _Google\ApiCore\CredentialsWrapper->Google\ApiCore\{closure}()_ (line _244_ of _/var/www/html/vendor/google/gax/src/CredentialsWrapper.php_).
The error appears to be related to: https://www.php.net/manual/en/migration83.incompatible.php; a backword incompatible change to version 8.3 of PHP:
Programs that were very close to overflowing the call stack may now throw an Error when using more than zend.max_allowed_stack_size-zend.reserved_stack_size bytes of stack (fiber.stack_size-zend.reserved_stack_size for fibers).
Perform a search on a custom Vertex AI Search page on a Drupal site that is hosted in an environment where the gRPC PHP extension (version 1.68+) is installed and the version of PHP is 8.3+.
The search will error out, but upon refresh or two, the search will complete.
Essentially, the gRPC transport is not working with PHP8.3 and the 1.68+ gRPC extension.
Ideally a fix needs to happen in the gRPC PHP extension.
Various workaround have been proposed.
The zend.max_allowed_stack_size is a System scope directive and can't be changed at runtime. Getting access to setting it in some environments could be difficult. Even if possible, the stack size check is being turned off.
The try/catch seems reasonable, however the retry-until-succeeds seems a bit hacky and this approach removes the performance benefit of using gRPC transport over REST.
Another approach is to provide control over which transport to use (REST or gRPC). If no transport is explicitly set when creating a Service Client (such as the Search Service Client provided by the Google Cloud Discovery client library) then gRPC will be used if it is available. In the case here, the gRPC extension is found and the gRPC Transport is attempted, and the error occurs. Using REST as a transport gets around this problem.
Having the option to specify REST vs gRPC is a good feature to have regardless of the existing bug. In the short term, it can be set to REST to circumvent any errors.
Active
1.0
Code
Automatically closed - issue fixed for 2 weeks with no activity.