Internal Error / Connection reset by peer on batch iteration after search_stream call

727 views
Skip to first unread message

Deny Watanabe

unread,
Dec 14, 2021, 7:10:28 AM12/14/21
to AdWords API and Google Ads API Forum
Hello, 

I'm having trouble with the latest update on the google ads API/Python API Library, these are my current versions:

google-ads               14.1.0
google-api-core          2.3.0
google-api-python-client 2.33.0
google-auth              2.3.3
google-auth-httplib2     0.1.0
google-auth-oauthlib     0.4.6
google-cloud             0.34.0
google-cloud-bigquery    2.30.1
google-cloud-core        2.2.1
google-cloud-storage     1.43.0
google-crc32c            1.3.0
google-resumable-media   2.1.0
googleapis-common-protos 1.53.0


The error happens when I try to get data using the search_stream method:

Request made: ClientCustomerId: xxxxxxxxxxxx, Host: googleads.googleapis.com, Method: /google.ads.googleads.v9.services.GoogleAdsService/SearchStream, RequestId: None, IsFault: True, FaultMessage: Connection reset by peer
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/google/api_core/grpc_helpers.py", line 106, in __next__
    return next(self._wrapped)
  File "/usr/local/lib/python3.9/dist-packages/google/ads/googleads/interceptors/response_wrappers.py", line 98, in __next__
    raise e
  File "/usr/local/lib/python3.9/dist-packages/google/ads/googleads/interceptors/response_wrappers.py", line 95, in __next__
    self._failure_handler(self._underlay_call)
  File "/usr/local/lib/python3.9/dist-packages/google/ads/googleads/interceptors/exception_interceptor.py", line 71, in _handle_grpc_failure
    raise self._get_error_from_response(response)
  File "/usr/local/lib/python3.9/dist-packages/google/ads/googleads/interceptors/response_wrappers.py", line 85, in __next__
    message = next(self._underlay_call)
  File "/usr/local/lib/python3.9/dist-packages/grpc/_channel.py", line 426, in __next__
    return self._next()
  File "/usr/local/lib/python3.9/dist-packages/grpc/_channel.py", line 642, in _next
    return self._next_response()
  File "/usr/local/lib/python3.9/dist-packages/grpc/_channel.py", line 617, in _next_response
    raise self
grpc._channel._SingleThreadedRendezvous: <_SingleThreadedRendezvous of RPC that terminated with:
        status = StatusCode.UNAVAILABLE
        details = "Connection reset by peer"
        debug_error_string = "{"created":"@1639480767.975827564","description":"Error received from peer ipv4:142.250.219.170:443","file":"src/core/lib/surface/call.cc","file_line":1063,"grpc_message":"Connection reset by peer","grpc_status":14}"
>

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

Traceback (most recent call last):
  File "/data/bin/gads2_importer.py", line 360, in <module>
    do_gads_import(app, sh)
  File "/data/bin/gads2_importer.py", line 229, in do_gads_import
    ga.get_data("adgroup_criterion", file_handle=fi, extra_where=campaign_filter)
  File "/usr/local/lib/python3.9/dist-packages/wmc/google_ads2.py", line 519, in get_data
    for batch in response:
  File "/usr/local/lib/python3.9/dist-packages/google/api_core/grpc_helpers.py", line 109, in __next__
    raise exceptions.from_grpc_error(exc) from exc
google.api_core.exceptions.ServiceUnavailable: 503 Connection reset by peer

Please note that the same request works fine for other accounts, and occasionally it also fails with "internal error".

Can you please help?

Thank you!

Deny


Google Ads API Forum Advisor

unread,
Dec 15, 2021, 1:08:53 AM12/15/21
to adwor...@googlegroups.com
Hi,

Thank you for posting your concern.

I completely understand your concern. As for the "Connection reset by peer" error, this issue appears to be client library specific. With this, I am afraid that our team would not be able to provide support here as it is outside of our scope already. I would suggest reaching out to the author of the client library instead via this link as they are more equipped here and provide insights to address the issue.

For the INTERNAL_ERROR, this occurs when unexpected happened while processing the request or the API isn't functioning correctly due to a bug. However, this is transient in nature and the API request will work again when retrying it after 30 seconds or some time. If this error occurred frequently on your end, then you can provide us the complete request and response logs with request ID and request header generated on your end so that we can investigate. If you haven't enabled the logging of the API transactions yet for your Python client library that you are using, then please follow this guide to extract the information that I am asking.

You can provide it via Reply privately to author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.

Regards,
Google Logo
Ernie John Blanca Tacata
Google Ads API Team
 


ref:_00D1U1174p._5004Q2TKzZD:ref
Reply all
Reply to author
Forward
0 new messages