googleapis / googleapis/google-cloud-python
Google Big Query Write append_rows does not respect retry configuration
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 1.8k
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 122
Description
Default configuration for append_rows() call [here](https://github.com/googleapis/python-bigquery-storage/blob/v2.19.1/google/cloud/bigquery_storage_v1/services/big_query_write/transports/base.py#L154) and [here](https://github.com/googleapis/python-bigquery-storage/blob/v2.19.1/google/cloud/bigquery_storage_v1/services/big_query_write/async_client.py#L468) 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:
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
```
Contributor guide
Assessment
This issue has not been assessed yet.