Title: ConnectionError in Client.insert_rows_json() · Issue #434 · googleapis/python-bigquery · GitHub
Open Graph Title: ConnectionError in Client.insert_rows_json() · Issue #434 · googleapis/python-bigquery
X Title: ConnectionError in Client.insert_rows_json() · Issue #434 · googleapis/python-bigquery
Description: We have a http Cloud Function that does some data processing and then streams to BQ. The function errors out sometimes because of either the bq client losing connection or it is the insert_rows that can't connect. See below an example of...
Open Graph Description: We have a http Cloud Function that does some data processing and then streams to BQ. The function errors out sometimes because of either the bq client losing connection or it is the insert_rows tha...
X Description: We have a http Cloud Function that does some data processing and then streams to BQ. The function errors out sometimes because of either the bq client losing connection or it is the insert_rows tha...
Opengraph URL: https://github.com/googleapis/python-bigquery/issues/434
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ConnectionError in Client.insert_rows_json()","articleBody":"We have a http Cloud Function that does some data processing and then streams to BQ. The function errors out sometimes because of either the bq client losing connection or it is the insert_rows that can't connect. \r\nSee below an example of a stack trace captured in the GCP logs.\r\n\r\n\r\n```\r\n File \"/layers/google.python.pip/pip/lib/python3.8/site-packages/flask/app.py\", line 2447, in wsgi_app\r\n response = self.full_dispatch_request()\r\n File \"/layers/google.python.pip/pip/lib/python3.8/site-packages/flask/app.py\", line 1952, in full_dispatch_request\r\n rv = self.handle_user_exception(e)\r\n File \"/layers/google.python.pip/pip/lib/python3.8/site-packages/flask/app.py\", line 1821, in handle_user_exception\r\n reraise(exc_type, exc_value, tb)\r\n File \"/layers/google.python.pip/pip/lib/python3.8/site-packages/flask/_compat.py\", line 39, in reraise\r\n raise value\r\n File \"/layers/google.python.pip/pip/lib/python3.8/site-packages/flask/app.py\", line 1950, in full_dispatch_request\r\n rv = self.dispatch_request()\r\n File \"/layers/google.python.pip/pip/lib/python3.8/site-packages/flask/app.py\", line 1936, in dispatch_request\r\n return self.view_functions[rule.endpoint](**req.view_args)\r\n File \"/layers/google.python.functions-framework/functions-framework/lib/python3.8/site-packages/functions_framework/__init__.py\", line 66, in view_func\r\n return function(request._get_current_object())\r\n File \"/workspace/main.py\", line 162, in stream_tax\r\n errors = bq.insert_rows_json(table=dataset_table,\r\n File \"/layers/google.python.pip/pip/lib/python3.8/site-packages/google/cloud/bigquery/client.py\", line 3013, in insert_rows_json\r\n response = self._call_api(\r\n File \"/layers/google.python.pip/pip/lib/python3.8/site-packages/google/cloud/bigquery/client.py\", line 636, in _call_api\r\n return call()\r\n File \"/layers/google.python.pip/pip/lib/python3.8/site-packages/google/api_core/retry.py\", line 281, in retry_wrapped_func\r\n return retry_target(\r\n File \"/layers/google.python.pip/pip/lib/python3.8/site-packages/google/api_core/retry.py\", line 184, in retry_target\r\n return target()\r\n File \"/layers/google.python.pip/pip/lib/python3.8/site-packages/google/cloud/_http.py\", line 427, in api_request\r\n response = self._make_request(\r\n File \"/layers/google.python.pip/pip/lib/python3.8/site-packages/google/cloud/_http.py\", line 291, in _make_request\r\n return self._do_request(\r\n File \"/layers/google.python.pip/pip/lib/python3.8/site-packages/google/cloud/_http.py\", line 329, in _do_request\r\n return self.http.request(\r\n File \"/layers/google.python.pip/pip/lib/python3.8/site-packages/google/auth/transport/requests.py\", line 464, in request\r\n response = super(AuthorizedSession, self).request(\r\n File \"/layers/google.python.pip/pip/lib/python3.8/site-packages/requests/sessions.py\", line 542, in request\r\n resp = self.send(prep, **send_kwargs)\r\n File \"/layers/google.python.pip/pip/lib/python3.8/site-packages/requests/sessions.py\", line 655, in send\r\n r = adapter.send(request, **kwargs)\r\n File \"/layers/google.python.pip/pip/lib/python3.8/site-packages/requests/adapters.py\", line 498, in send\r\n raise ConnectionError(err, request=request)\r\nrequests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))\r\n```\r\n\r\n\r\n- `bq` (=`bigquery.Client()`) in the trace is instantiated as a global variable as recommended here: https://cloud.google.com/functions/docs/bestpractices/networking#accessing_google_apis\r\n\r\n- error is logged 30 secs after function is invoked - so can't be the 60s default timeout in `-http`\r\n\r\nThoughts ?","author":{"url":"https://github.com/yan-hic","@type":"Person","name":"yan-hic"},"datePublished":"2020-12-10T22:16:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/434/python-bigquery/issues/434"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:86c8a349-8bab-5691-2b65-819272917f0e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E058:323A96:1827B61:2326A2A:6A4E5036 |
| html-safe-nonce | 9e8f98d247e8569994edc0ec4795c383b722dc27c630a0cd33b0485beddb30fa |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMDU4OjMyM0E5NjoxODI3QjYxOjIzMjZBMkE6NkE0RTUwMzYiLCJ2aXNpdG9yX2lkIjoiOTExMTAwOTIwMDE4NDM4MTQ5NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 589f02c748dbda1e5573547582ad45b09b483c9d7eb1a5f900d6b278fc5052a3 |
| hovercard-subject-tag | issue:761662219 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/python-bigquery/434/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2d531d83026da1b61c98399941e884807771a3192ac1a06dc165e49e6c22934c/googleapis/python-bigquery/issues/434 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2d531d83026da1b61c98399941e884807771a3192ac1a06dc165e49e6c22934c/googleapis/python-bigquery/issues/434 |
| og:image:alt | We have a http Cloud Function that does some data processing and then streams to BQ. The function errors out sometimes because of either the bq client losing connection or it is the insert_rows tha... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | yan-hic |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/python-bigquery git https://github.com/googleapis/python-bigquery.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 226992475 |
| octolytics-dimension-repository_nwo | googleapis/python-bigquery |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 226992475 |
| octolytics-dimension-repository_network_root_nwo | googleapis/python-bigquery |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f344f1eab54fc7dfc02d0d018cda7e158c3db65c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width