-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken Pipe exceptions raised after idle periods #218
Comments
It's likely that c6425a0 fixed this, but we haven't cut a new release. Can you try the HEAD version and see if you still see this issue? |
Still happening on master:
|
Is that a |
Fixed in 713b1de. |
Hi, I'm using the Cloud-Vision API in python with similar conditions (a long-lived object and long idle sessions between requests) I get the same error message a lot, therefore I wonder if this could be the same problem mentioned above, so pulling the latest commit should fix it. I copy the related part from traceback here: in detect_text responses = request.execute(num_retries=num_retries) File "/opt/python/run/venv/lib/python2.7/site-packages/oauth2client/util.py", line 135, in positional_wrapper return wrapped(_args, *_kwargs) File "/opt/python/run/venv/lib/python2.7/site-packages/googleapiclient/http.py", line 755, in execute method=str(self.method), body=self.body, headers=self.headers) File "/opt/python/run/venv/lib/python2.7/site-packages/googleapiclient/http.py", line 93, in _retry_request resp, content = http.request(uri, method, _args, *_kwargs) File "/opt/python/run/venv/lib/python2.7/site-packages/oauth2client/client.py", line 621, in new_request redirections, connection_type) File "/opt/python/run/venv/lib/python2.7/site-packages/httplib2/init.py", line 1609, in request (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey) File "/opt/python/run/venv/lib/python2.7/site-packages/httplib2/init.py", line 1351, in _request (response, content) = self._conn_request(conn, request_uri, method, body, headers) File "/opt/python/run/venv/lib/python2.7/site-packages/httplib2/init.py", line 1273, in _conn_request conn.request(method, request_uri, body, headers) File "/usr/lib64/python2.7/httplib.py", line 1001, in request self._send_request(method, url, body, headers) File "/usr/lib64/python2.7/httplib.py", line 1035, in _send_request self.endheaders(body) File "/usr/lib64/python2.7/httplib.py", line 997, in endheaders self._send_output(message_body) File "/usr/lib64/python2.7/httplib.py", line 850, in _send_output self.send(msg) File "/usr/lib64/python2.7/httplib.py", line 826, in send self.sock.sendall(data) File "/usr/lib64/python2.7/ssl.py", line 701, in sendall v = self.send(data[count:]) File "/usr/lib64/python2.7/ssl.py", line 667, in send v = self._sslobj.write(data) error: [Errno 32] Broken pipe |
Let us know if it fixes you. @nathanielmanistaatgoogle should we cut another minor release? |
@jonparrott Probably! Have you any time in the next few days? |
Maybe Friday. I'll make a bug for it. |
I'm having this issue using the google bigquery API. I'm pulling data from Azure SQL Server in batches and sending to bigquery. I have to use batches with some of the tables because of their size. Because of filtering, ordering and batching of some of the tables, the pulls from Azure take longer than pulls from other tables. I'm getting the broken pipe error on tables with longer pulls. I've tried several different batch sizes with the same result. Any advice would be greatly appreciated. |
@klday are you experiencing this with the latest release? |
Sorry, I left out some important information: I'm using pandas to_gbq() to import the data to BigQuery. Here is my terminal output for the traceback: |
The latest release of ...? |
This library, 1.5.2? |
Honestly, I have no idea. I just downloaded the google api tools for the cloud platform. Those are the most recent tools. And, I installed those using the command line. I'm not sure what library you're referring to, but I'm also relatively new to programming. |
@klday no worries. Can you open up
|
Yes, thank you. The output is:
I am working in a docker container. I have been creating a google cloud resource to work with the bigquery api tools using a key (pretty sure I'm explaining that correctly). |
well, in that case I don't know. It could be an underlying issue with httplib2. In which case you can try using httplib2shim to see if it fixes it. |
Ok, thank you. I'll give that a shot. |
FWIW, I just got this with 1.5.3 (From FreeBSD 10.1, python 3.5.1 if that matters). I guess there's no progress with it? Have updated to 1.5.4 (w/ oauth2client 4.0.0) now, will see what happens |
@LordAro this should definitely be occurring less often. If you can provide a full stacktrace that will be helpful. |
Sure
|
I'm also getting the broken pipe on BatchHttpRequest() I can get through thousands of calls to the shopping api, but if we have a quiet period, then I get the broken pipe. |
This issue is most likely due to httplib2's connection pooling logic. I'd suggest trying httplib2shim. |
@jonparrott currently testing this and it seems to have fixed the problem Is it worth making this the required method for connecting ? |
@Bobspadger probably not, but we're soon replacing oauth2client in this library with google-auth, which will allow us to use urllib3 and requests without needing httplib2shim. |
@jonparrott excellent, requests makes life so much easier! |
@jonparrott Any timeline on this replacement endeavor? It seems like a great idea and this bug is truly annoying. |
Always the issue |
This broken pipe issue has occurred again for me now I'm moving to googles v2.1 content API and i'm using a service account (no longer httplib2shim as I've followed the instructions from your example and using all the google libraries. Is the answer to go back to using httplib2shim. I too have a long life client - does this need rebuilding before every run ? |
? |
This is now happening to me via a Cloud Run execution that happens every 30 minutes. What's the status of this fix? Why was the issue closed when there is no solution or fix in place? |
Hi, I'm having the same issue via Cloud Run also. I randomly get "Broken Pipe" or "connection reset by peer" errors. |
OK this is just a FYI in case someone is having the same problem. I am getting the Broken Pipe error while using Firebase messaging via Cloud Run. |
Fix for exception: See also googleapis/google-api-python-client#218 (comment) Traceback (most recent call last): File "/work/src/experiment/scheduler.py", line 602, in schedule_loop trial_instance_manager.handle_preempted_trials() File "/work/src/experiment/scheduler.py", line 538, in handle_preempted_trials if not delete_instances(instances, self.experiment_config): File "/work/src/experiment/scheduler.py", line 112, in delete_instances i for i in gce.get_instances(cloud_project, cloud_compute_zone) File "/work/src/experiment/scheduler.py", line 112, in <listcomp> i for i in gce.get_instances(cloud_project, cloud_compute_zone) File "/work/src/common/gce.py", line 46, in get_instances for instance in _get_instance_items(project, zone): File "/work/src/common/gce.py", line 37, in _get_instance_items response = request.execute() File "/work/.venv/lib/python3.7/site-packages/googleapiclient/_helpers.py", line 134, in positional_wrapper return wrapped(*args, **kwargs) File "/work/.venv/lib/python3.7/site-packages/googleapiclient/http.py", line 901, in execute headers=self.headers, File "/work/.venv/lib/python3.7/site-packages/googleapiclient/http.py", line 204, in _retry_request raise exception File "/work/.venv/lib/python3.7/site-packages/googleapiclient/http.py", line 177, in _retry_request resp, content = http.request(uri, method, *args, **kwargs) File "/work/.venv/lib/python3.7/site-packages/oauth2client/transport.py", line 186, in new_request credentials._refresh(orig_request_method) File "/work/.venv/lib/python3.7/site-packages/oauth2client/client.py", line 749, in _refresh self._do_refresh_request(http) File "/work/.venv/lib/python3.7/site-packages/oauth2client/client.py", line 780, in _do_refresh_request body=body, headers=headers) File "/work/.venv/lib/python3.7/site-packages/oauth2client/transport.py", line 282, in request connection_type=connection_type) File "/work/.venv/lib/python3.7/site-packages/httplib2/__init__.py", line 1994, in request cachekey, File "/work/.venv/lib/python3.7/site-packages/httplib2/__init__.py", line 1651, in _request conn, request_uri, method, body, headers File "/work/.venv/lib/python3.7/site-packages/httplib2/__init__.py", line 1558, in _conn_request conn.request(method, request_uri, body, headers) File "/usr/local/lib/python3.7/http/client.py", line 1252, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.7/http/client.py", line 1065, in _send_output self.send(chunk) File "/usr/local/lib/python3.7/http/client.py", line 987, in send self.sock.sendall(data) File "/usr/local/lib/python3.7/ssl.py", line 1034, in sendall v = self.send(byte_view[count:]) File "/usr/local/lib/python3.7/ssl.py", line 1003, in send return self._sslobj.write(data) BrokenPipeError: [Errno 32] Broken pipe Message: Error occurred during scheduling."
Fix for exception: See also googleapis/google-api-python-client#218 (comment) Traceback (most recent call last): File "/work/src/experiment/scheduler.py", line 602, in schedule_loop trial_instance_manager.handle_preempted_trials() File "/work/src/experiment/scheduler.py", line 538, in handle_preempted_trials if not delete_instances(instances, self.experiment_config): File "/work/src/experiment/scheduler.py", line 112, in delete_instances i for i in gce.get_instances(cloud_project, cloud_compute_zone) File "/work/src/experiment/scheduler.py", line 112, in <listcomp> i for i in gce.get_instances(cloud_project, cloud_compute_zone) File "/work/src/common/gce.py", line 46, in get_instances for instance in _get_instance_items(project, zone): File "/work/src/common/gce.py", line 37, in _get_instance_items response = request.execute() File "/work/.venv/lib/python3.7/site-packages/googleapiclient/_helpers.py", line 134, in positional_wrapper return wrapped(*args, **kwargs) File "/work/.venv/lib/python3.7/site-packages/googleapiclient/http.py", line 901, in execute headers=self.headers, File "/work/.venv/lib/python3.7/site-packages/googleapiclient/http.py", line 204, in _retry_request raise exception File "/work/.venv/lib/python3.7/site-packages/googleapiclient/http.py", line 177, in _retry_request resp, content = http.request(uri, method, *args, **kwargs) File "/work/.venv/lib/python3.7/site-packages/oauth2client/transport.py", line 186, in new_request credentials._refresh(orig_request_method) File "/work/.venv/lib/python3.7/site-packages/oauth2client/client.py", line 749, in _refresh self._do_refresh_request(http) File "/work/.venv/lib/python3.7/site-packages/oauth2client/client.py", line 780, in _do_refresh_request body=body, headers=headers) File "/work/.venv/lib/python3.7/site-packages/oauth2client/transport.py", line 282, in request connection_type=connection_type) File "/work/.venv/lib/python3.7/site-packages/httplib2/__init__.py", line 1994, in request cachekey, File "/work/.venv/lib/python3.7/site-packages/httplib2/__init__.py", line 1651, in _request conn, request_uri, method, body, headers File "/work/.venv/lib/python3.7/site-packages/httplib2/__init__.py", line 1558, in _conn_request conn.request(method, request_uri, body, headers) File "/usr/local/lib/python3.7/http/client.py", line 1252, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.7/http/client.py", line 1065, in _send_output self.send(chunk) File "/usr/local/lib/python3.7/http/client.py", line 987, in send self.sock.sendall(data) File "/usr/local/lib/python3.7/ssl.py", line 1034, in sendall v = self.send(byte_view[count:]) File "/usr/local/lib/python3.7/ssl.py", line 1003, in send return self._sslobj.write(data) BrokenPipeError: [Errno 32] Broken pipe Message: Error occurred during scheduling."
We are also experiencing this issue after upgrading to the latest version. Would it be appropriate to re-open this ticket, or should I introduce a new one? |
We have the same issue when periodically call status of long ai platform training job from CE instance. p.s. update to google.auth (1.24.0) did not help. |
I am encountered same issue too. |
The same for me with ml engine train |
Our customers are getting this error when polling DataProc. |
Unfortunately, this cannot completely replace the outer retry loop, which addresses an issue for long running client due to googleapis/google-api-python-client#218 . Updated comments for that instead. PiperOrigin-RevId: 381029373
Unfortunately, this cannot completely replace the outer retry loop, which addresses an issue for long running client due to googleapis/google-api-python-client#218 . Updated comments for that instead. PiperOrigin-RevId: 381029373
Unfortunately, this cannot completely replace the outer retry loop, which addresses an issue for long running client due to googleapis/google-api-python-client#218 . Updated comments for that instead. PiperOrigin-RevId: 381075453
I get this with the Google drive API as well :/ |
I got this error as well and it has been almost a year. I believe I have all latest versions. |
I get the same problem when calling the compute api File "/layers/google.python.pip/pip/lib/python3.9/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/functions_framework/__init__.py", line 171, in view_func
function(data, context)
File "/workspace/main.py", line 73, in periodic_check
status = compute.instances().get(project=project, zone=zone, instance=instance).execute()['status']
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/googleapiclient/_helpers.py", line 131, in positional_wrapper
return wrapped(*args, **kwargs)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/googleapiclient/http.py", line 922, in execute
resp, content = _retry_request(
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/googleapiclient/http.py", line 221, in _retry_request
raise exception
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/googleapiclient/http.py", line 190, in _retry_request
resp, content = http.request(uri, method, *args, **kwargs)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/google_auth_httplib2.py", line 218, in request
response, content = self.http.request(
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/httplib2/__init__.py", line 1725, in request
(response, content) = self._request(
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/httplib2/__init__.py", line 1441, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/httplib2/__init__.py", line 1364, in _conn_request
conn.request(method, request_uri, body, headers)
File "/opt/python3.9/lib/python3.9/http/client.py", line 1285, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/opt/python3.9/lib/python3.9/http/client.py", line 1331, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/opt/python3.9/lib/python3.9/http/client.py", line 1280, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/opt/python3.9/lib/python3.9/http/client.py", line 1040, in _send_output
self.send(msg)
File "/opt/python3.9/lib/python3.9/http/client.py", line 1001, in send
self.sock.sendall(data)
File "/opt/python3.9/lib/python3.9/ssl.py", line 1204, in sendall
v = self.send(byte_view[count:])
File "/opt/python3.9/lib/python3.9/ssl.py", line 1173, in send
return self._sslobj.write(data)
BrokenPipeError: [Errno 32] Broken pipe |
I am having this error when using Python Gmail API. |
If anyone is experiencing the |
I'm using long-lived client objects like so:
And running into exceptions on the calls to
do_another_thing()
:I would expect the num_retries argument to handle these exceptions in https://github.com/google/google-api-python-client/blob/master/googleapiclient/http.py#L145, but for the time being I have to implement my own retry logic around all API calls to overcome this.
The text was updated successfully, but these errors were encountered: