Skip to content

Google Big Query Write append_rows does not respect retry configuration #593

Open
@kamilglod

Description

@kamilglod

Default configuration for append_rows() call here and here sets that by default request would be retired in case of google.api_core.exceptions.ServiceUnavailable exception with a timeout of 1 day. However I observed that in case of this server response it raises this exception without retrying the call.

Environment details

  • OS type and version: Debian 11
  • Python version: 3.11.2
  • pip version: 22.3.1
  • google-cloud-bigquery-storage version: 2.19.0

Steps to reproduce

  1. Create async iterator that is yielding new rows with some random delay
  2. Start new stream and use async iterator created in step 1 to pass it to the append_rows()
  3. Observe that occassionally this process fails without retrying, even with errors that are passed to the default retry config as a predicate

Stack trace

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/google/api_core/grpc_helpers_async.py", line 73, in wait_for_connection
    await self._call.wait_for_connection()
  File "/usr/local/lib/python3.11/site-packages/grpc/aio/_call.py", line 483, in wait_for_connection
    await self._raise_for_status()
  File "/usr/local/lib/python3.11/site-packages/grpc/aio/_call.py", line 236, in _raise_for_status
    raise _create_rpc_error(await self.initial_metadata(), await
grpc.aio._call.AioRpcError: <AioRpcError of RPC that terminated with:
	status = StatusCode.UNAVAILABLE
	details = "recvmsg:Connection reset by peer"
	debug_error_string = "UNKNOWN:Error received from peer  {grpc_message:"recvmsg:Connection reset by peer", grpc_status:14, created_time:"2023-04-26T09:58:29.10477569+00:00"}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/src/reporter/backends/bigquery.py", line 144, in _stream_exceptions_task
    await self.exceptions_bq_stream.stream(self.exceptions_iterator)
  File "/usr/local/lib/python3.11/site-packages/prisjakt_ingestion_utils/clients/gcp_big_query/gcp_big_query_stream.py", line 130, in stream
    stream = await self.client.append_rows(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/google/api_core/grpc_helpers_async.py", line 179, in error_remapped_callable
    await call.wait_for_connection()
  File "/usr/local/lib/python3.11/site-packages/google/api_core/grpc_helpers_async.py", line 75, in wait_for_connection
    raise exceptions.from_grpc_error(rpc_error) from rpc_error
google.api_core.exceptions.ServiceUnavailable: 503 recvmsg:Connection reset by peer

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: bigquerystorageIssues related to the googleapis/python-bigquery-storage API.priority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions