google-cloud-php: [Spanner] GRPC randomly throws ServiceException("Socket closed")

We occasionally see this error in production.

Google\Cloud\Core\Exception\ServiceException: { "message": "Socket closed", "code": 14, "status": "UNAVAILABLE", "details": [] }
at Google\Cloud\Core\GrpcRequestWrapper->handleStream (/project/vendor/google/cloud-core/src/GrpcRequestWrapper.php:254)
at Generator->valid ([internal function])
at Google\Cloud\Spanner\Result->rows (/project/vendor/google/cloud-spanner/src/Result.php:177)
at iterator_to_array ([internal function])

This error occurs randomly across various places where we use spanner.

How can I resolve this?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23 (16 by maintainers)

Most upvoted comments

Awesome, thanks for testing this out @taka-oyama. We will get this merged today and a release following shortly!

@castaneai, from what I can remember our original guidance from the Spanner team was to only retry when a resume token is available. With that said, it does seem reasonable to retry on the first valid call since we haven’t received any rows yet. I’m certainly open to adding this in.

We are looking in to whether wrapping the valid() call with a try/catch block will help.

/cc @snehashah16 (our Spanner contact) for some assistance around your question regarding GKE parameters and the differences seen in the stress environment.