This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Calls to create_dataset and get_table are timing out #34
Copy link
Copy link
Closed
Labels
api: bigqueryIssues related to the googleapis/python-bigquery API.Issues related to the googleapis/python-bigquery API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.status: awaiting informationtype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
We're getting some frequent test failures in the pandas integration tests due to timed out requests, possibly due to googleapis/google-cloud-python#10219 which added non-None default timeout.
It seems 60 seconds is not enough for these calls (but strange that so many API requests are timing out).
Environment details
Context: googleapis/python-bigquery-pandas#309
Steps to reproduce
- Make frequent calls to
create_dataset. - Observe flakey tests.
Stack trace
if new_retry.is_exhausted():
> raise MaxRetryError(_pool, url, error or ResponseError(cause))
E urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='bigquery.googleapis.com', port=443): Max retries exceeded with url: /bigquery/v2/projects/pandas-travis/datasets/pydata_pandas_bq_testing_dddqwbgrjz/tables/hrsctwrmva (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7ff87946e898>: Failed to establish a new connection: [Errno 110] Connection timed out',))
../../../miniconda3/envs/pandas-dev/lib/python3.6/site-packages/urllib3/util/retry.py:436: MaxRetryError
During handling of the above exception, another exception occurred:
self = <pandas.tests.io.test_gbq.TestToGBQIntegrationWithServiceAccountKeyPath object at 0x7ff879725160>
gbq_dataset = 'pydata_pandas_bq_testing_dddqwbgrjz.hrsctwrmva'
def test_roundtrip(self, gbq_dataset):
destination_table = gbq_dataset
test_size = 20001
df = make_mixed_dataframe_v2(test_size)
df.to_gbq(
destination_table,
_get_project_id(),
chunksize=None,
> credentials=_get_credentials(),
)
pandas/tests/io/test_gbq.py:185:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pandas/core/frame.py:1551: in to_gbq
credentials=credentials,
pandas/io/gbq.py:219: in to_gbq
private_key=private_key,
../../../miniconda3/envs/pandas-dev/lib/python3.6/site-packages/pandas_gbq/gbq.py:1202: in to_gbq
if table.exists(table_id):
../../../miniconda3/envs/pandas-dev/lib/python3.6/site-packages/pandas_gbq/gbq.py:1312: in exists
self.client.get_table(table_ref)
../../../miniconda3/envs/pandas-dev/lib/python3.6/site-packages/google/cloud/bigquery/client.py:679: in get_table
retry, method="GET", path=table_ref.path, timeout=timeout
../../../miniconda3/envs/pandas-dev/lib/python3.6/site-packages/google/cloud/bigquery/client.py:556: in _call_api
return call()
../../../miniconda3/envs/pandas-dev/lib/python3.6/site-packages/google/api_core/retry.py:286: in retry_wrapped_func
on_error=on_error,
../../../miniconda3/envs/pandas-dev/lib/python3.6/site-packages/google/api_core/retry.py:184: in retry_target
return target()
../../../miniconda3/envs/pandas-dev/lib/python3.6/site-packages/google/cloud/_http.py:419: in api_request
timeout=timeout,
../../../miniconda3/envs/pandas-dev/lib/python3.6/site-packages/google/cloud/_http.py:277: in _make_request
method, url, headers, data, target_object, timeout=timeout
../../../miniconda3/envs/pandas-dev/lib/python3.6/site-packages/google/cloud/_http.py:315: in _do_request
url=url, method=method, headers=headers, data=data, timeout=timeout
../../../miniconda3/envs/pandas-dev/lib/python3.6/site-packages/google/auth/transport/requests.py:317: in request
**kwargs
../../../miniconda3/envs/pandas-dev/lib/python3.6/site-packages/requests/sessions.py:533: in request
resp = self.send(prep, **send_kwargs)
../../../miniconda3/envs/pandas-dev/lib/python3.6/site-packages/requests/sessions.py:646: in send
r = adapter.send(request, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Metadata
Metadata
Assignees
Labels
api: bigqueryIssues related to the googleapis/python-bigquery API.Issues related to the googleapis/python-bigquery API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.status: awaiting informationtype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Activity
shollyman commentedon Feb 7, 2020
Do the tests favor a particular region? Always running in US multiregion?
tswast commentedon Feb 7, 2020
Just the default US region. None of the
to_gbqtests at https://github.com/pandas-dev/pandas/blob/8105a7e8282edba5c98138ac09ed2c3bec7823e6/pandas/tests/io/test_gbq.py explicitly set a region.meredithslota commentedon Feb 24, 2020
Assigning Seth but if this is something @plamut could look at, let's discuss.
plamut commentedon Feb 25, 2020
I'm currently working on #40 which might be similar. Once that is done, we can re-check and see if it also helped with this issue.
meredithslota commentedon Mar 13, 2020
#40 seems closed now; @plamut can you take a look?
plamut commentedon Mar 13, 2020
@meredithslota Sure, will take a look at it early next week when I come back.
plamut commentedon Mar 20, 2020
Currently awaiting response to a question posted under the related Pandas GBQ ticket.
meredithslota commentedon Aug 19, 2020
googleapis/python-bigquery-pandas#309 links to Travis failures but I see a recent build passing (https://travis-ci.org/github/pandas-dev/pandas/builds/705824144) re: re-enabling pandas-gbq tests. So, my guess is that this work spanned three different repos and this has been fixed by the changes @plamut made earlier. I'm cautiously closing this but please reopen if you are still seeing issues.
drmario-gh commentedon Jan 20, 2022
Hi,
Since January, 17th (2022) we have started experiencing ReadTimeout errors in the
get_tablemethod. They represent a very small portion of our streaming attempts: around 190 timeouts in 11,1 million messages. This does not create a real problem for us but we are a bit scared because of their sudden increase. They were extremely rare in the past (below 1 per week).For context, this happens in a component that streams Pub/Sub messages into BigQuery, which has been live for quite a long time (years). We are also concerned because we are using quite an old version of the bigquery library (we are currently working towards updating it) and we are wondering if there is some looming deprecation we don't know about.
We have seen that there has been some work going around about timeout values (#889) and we might be able to bump our google-cloud-biquery version a little easily: is there any near version we should prefer/avoid?
Thank you!
Environment details
google-cloud-bigqueryversion: 1.17.0Full traceback of one of the timeouts:
tswast commentedon Jan 20, 2022
@drmario-gh Retries for
requeststimeout errors weren't added until #896Even though this was added in 2.25.1, I recommend version 2.27.0 or later. #896 came with a default timeout which caused problems for some long running queries.
https://github.com/googleapis/python-bigquery/blob/main/CHANGELOG.md#2270-2021-09-24
tswast commentedon Jan 20, 2022
There is a v3 library coming very soon, but it only affects the "models" API along with some changes to default dtypes in the pandas connector. #1021
FBosler commentedon Oct 18, 2022
@drmario-gh Seeing the exact same behaviour right now. Have an ETL-project that's been live for years and relies on
get_tableto verify if a table has been created or not. As I am writing this, the get_table calls are just not finishing anymore (been waiting for minutes). Typically these calls would only take seconds.We currently are using
google-cloud-bigquery==2.12.0.Did you ultimately figure out what was happening?