GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Frequent gRPC StatusCode.UNAVAILABLE errors · Issue #2683 · googleapis/google-cloud-python

Frequent gRPC StatusCode.UNAVAILABLE errors #2683

New issue
Copy link
New issue
Copy link
Closed
Closed
Frequent gRPC StatusCode.UNAVAILABLE errors#2683
Copy link
Assignees
tseavertheacodes
Labels
grpcpriority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Description

@forsberg
forsberg
opened on Nov 4, 2016
Issue body actions

Using the current codebase from master branch (e1fbb6b), with GRPC, we sometimes (0.5% of requests, approximately) see the following exception:

 AbortionError(code=StatusCode.UNAVAILABLE, details="{"created":"@1478255129.468798425","description":"Secure read failed","file":"src/core/lib/security/transport/secure_endpoint.c","file_line":157,"grpc_status":14,"referenced_errors":[{"created":"@1478255129.468756939","description":"EOF","file":"src/core/lib/iomgr/tcp_posix.c","file_line":235}]}"))

Retrying this seem to always succeed.

Should application code have to care about this kind of error and retry? Or is this a bug in google-cloud-pubsub code?

Package versions installed:

gapic-google-logging-v2==0.10.1
gapic-google-pubsub-v1==0.10.1
google-api-python-client==1.5.4
google-cloud==0.20.0
google-cloud-bigquery==0.20.0
google-cloud-bigtable==0.20.0
google-cloud-core==0.20.0
google-cloud-datastore==0.20.1
google-cloud-dns==0.20.0
google-cloud-error-reporting==0.20.0
google-cloud-language==0.20.0
google-cloud-logging==0.20.0
google-cloud-monitoring==0.20.0
google-cloud-pubsub==0.20.0
google-cloud-resource-manager==0.20.0
google-cloud-storage==0.20.0
google-cloud-translate==0.20.0
google-cloud-vision==0.20.0
google-gax==0.14.1
googleapis-common-protos==1.3.5
grpc-google-iam-v1==0.10.1
grpc-google-logging-v2==0.10.1
grpc-google-pubsub-v1==0.10.1
grpcio==1.0.0

Note: Everything google-cloud* comes from git master.

This is on Python 2.7.3

Traceback:

  File "ospdatasubmit/pubsub.py", line 308, in _flush
    publish_response = self.pubsub_client.Publish(publish_request, self._publish_timeout)
  File "grpc/beta/_client_adaptations.py", line 305, in __call__
    self._request_serializer, self._response_deserializer)
  File "grpc/beta/_client_adaptations.py", line 203, in _blocking_unary_unary
    raise _abortion_error(rpc_error_call)

Activity

Next
  1. daspecster
    added
    api: pubsubIssues related to the Pub/Sub API.
    grpc
    on Nov 4, 2016
  2. dhermes commented on Nov 4, 2016

    @dhermes
    dhermes
    on Nov 4, 2016
    Contributor
    More actions

    @forsberg As you can see from the stack trace, this comes from grpc.beta (the beta interface). We haven't used the beta interface for some time. How are you installing the library?

  3. dhermes commented on Nov 4, 2016

    @dhermes
    dhermes
    on Nov 4, 2016
    Contributor
    More actions

    @nathanielmanistaatgoogle I can consistently reproduce an Unavailable error when a connection goes stale. Is there any way to avoid this, short of retrying on failures?

  4. forsberg commented on Nov 4, 2016

    @forsberg
    forsberg
    on Nov 4, 2016
    Author
    More actions

    That library installation seems to have gone horribly wrong. We had an earlier version using the grpc.beta interface, and I guess installing this into the same virtualenv, something went wrong. Will investigate that on Monday.

  5. dhermes commented on Nov 4, 2016

    @dhermes
    dhermes
    on Nov 4, 2016
    Contributor
    More actions

    @forsberg grpc 1.0 still supports the beta interface, but none of google-cloud-python (or its dependencies) use that interface any longer. So it'd be your google-cloud-python install that's b0rked rather than your grpc install.

  6. forsberg
    changed the title [-] AbortionError(code=StatusCode.UNAVAILABLE, ...[/-] [+]Frequent gRPC StatusCode.UNAVAILABLE errors[/+] on Nov 7, 2016
  7. forsberg
    added
    api: datastoreIssues related to the Datastore API.
    api: loggingIssues related to the Cloud Logging API.
    on Nov 7, 2016
  8. dhermes commented on Nov 7, 2016

    @dhermes
    dhermes
    on Nov 7, 2016
    Contributor
    More actions

    @nathanielmanistaatgoogle See #2693 and #2699. What is the recommended way to deal with this for stale connections?

  9. forsberg commented on Nov 17, 2016

    @forsberg
    forsberg
    on Nov 17, 2016
    Author
    More actions

    Small update: We have fixed our borked google-cloud-python install to actually use e1fbb6bc, but we're still seeing roughly the same number of UNAVAILABLE - retrying always works on first attempt.

  10. dhermes commented on Nov 17, 2016

    @dhermes
    dhermes
    on Nov 17, 2016
    Contributor
    More actions

    @nathanielmanistaatgoogle Bump

  11. dhermes commented on Nov 28, 2016

    @dhermes
    dhermes
    on Nov 28, 2016
    Contributor
    More actions

    @nathanielmanistaatgoogle Bump

    /cc @geigerj This is the issue I was referring to about GAPIC retry strategies

  12. geigerj commented on Nov 28, 2016

    @geigerj
    geigerj
    on Nov 28, 2016
    Contributor
    More actions

    @dhermes You can configure this on the GAPIC layer, see comment here for details. It actually looks like we already retry by default on UNAVAILABLE for Pub/Sub Publish, but you can override the default settings to extend the timeout on retry if that's the issue?

  13. jgoclawski commented on Dec 3, 2016

    @jgoclawski
    jgoclawski
    on Dec 3, 2016
    More actions

    @geigerj I believe the correct link to "retry by default on UNAVAILABLE for Pub/Sub Publish" is this one, because the one you've provided no longer works.
    The bug affects us too. When the connection is stale, we get exactly the same error as here (grpc._channel._Rendezvous but caused by PubSub publish action). Once we retry, it works.

    We're using:

    gapic-google-pubsub-v1==0.11.1
    google-cloud-core==0.21.0
    google-cloud-pubsub==0.21.0
    google-gax==0.15.0
    googleapis-common-protos==1.5.0
    grpc-google-iam-v1==0.11.1
    grpc-google-pubsub-v1==0.11.1
    

    What seems strange is that the default retry you mentioned doesn't seem to work. And I have checked that the file publisher_client_config.json is present, with correct values. I get the unhandled exception much sooner than 60s, almost immediately (haven't measured it precisely).

    Updated:
    It seems that I was wrong about dependency versions, but publisher_client_config.json is the same. I don't think that it will change anything, but I will switch to newest versions and report back.
    Actual versions:

    gapic-google-pubsub-v1==0.10.1
    google-cloud-core==0.21.0
    google-cloud-pubsub==0.21.0
    google-gax==0.14.1
    googleapis-common-protos==1.5.0
    grpc-google-iam-v1==0.10.1
    grpc-google-pubsub-v1==0.10.1
    grpcio==1.0.1
    

    Updated 2:
    Newest versions do not fix this issue.
    I'm still getting

    GaxError(RPC failed, caused by <_Rendezvous of RPC that terminated with (StatusCode.UNAVAILABLE, {"created":"@1480777925.720435842","description":"Secure read failed","file":"src/core/lib/security/transport/secure_endpoint.c","file_line":157,"grpc_status":14,"referenced_errors":[{"created":"@1480777925.720399286","description":"EOF","file":"src/core/lib/iomgr/tcp_posix.c","file_line":235}]})>)
    

    when using a stale connection. Retrying fixes the issue.

    Package versions:

    gapic-google-cloud-pubsub-v1==0.14.0
    google-cloud-core==0.21.0
    git+https://github.com/GoogleCloudPlatform/google-cloud-python.git@a02ac500548cf9fc37f4d81033e696a0efb53f99#egg=google-cloud-pubsub&subdirectory=pubsub
    google-gax==0.15.0
    googleapis-common-protos==1.5.0
    grpc-google-cloud-pubsub-v1==0.14.0
    grpc-google-iam-v1==0.11.1
    grpcio==1.0.1
    

    (google-cloud-pubsub installed from Git master)

  14. 50 remaining items

  15. lukesneeringer commented on Aug 8, 2017

    @lukesneeringer
    lukesneeringer
    on Aug 8, 2017
    Contributor
    More actions

    I am removing all the "api: X" labels from this issue since issue automation is coming. The grpc label is the appropriate tracking.

    Although really this should just be moved to grpc.

  16. sx5640 commented on Sep 18, 2017

    @sx5640
    sx5640
    on Sep 18, 2017
    More actions

    Reproduced the Bigtable issue with google-cloud-bigtable==0.26.0 during:

    def write_row(key, column_id):
        """
        Utility method for writing a row to BigTable.
        Note that we don't actually store values - the column ids are where we actually store values,
        so the value is always just an empty string.
        :param key: Key of the row to write
        :param column_id: This is the actual value we want stored.
        :return: None
        """
        row = db.table.row(key)
        row.set_cell(conf.column_family_id, column_id, '')
        row.commit()
    

    The error looks like:

    _Rendezvous: <_Rendezvous of RPC that terminated with (StatusCode.UNAVAILABLE, Endpoint read failed)>
    at _end_unary_response_blocking (/env/local/lib/python2.7/site-packages/grpc/_channel.py:455)
    at __call__ (/env/local/lib/python2.7/site-packages/grpc/_channel.py:507)
    at commit (/env/local/lib/python2.7/site-packages/google/cloud/bigtable/row.py:417)
    
  17. ericbbraga commented on Oct 5, 2017

    @ericbbraga
    ericbbraga
    on Oct 5, 2017
    More actions

    Hi guys,
    I'm also facing this issue but with PubSub subscription.
    We've started a subscription for one topic yesterday and all is working fine.
    However, today we saw this exception on the console.

    I'm using the following packages:

    google-auth==1.1.1
    google-cloud-bigquery==0.27.0
    google-cloud-core==0.27.1
    google-cloud-logging==1.3.0
    google-cloud-pubsub==0.28.3
    google-cloud-storage==1.4.0
    google-gax==0.15.15
    google-resumable-media==0.2.3
    googleapis-common-protos==1.5.3
    grpc-google-iam-v1==0.11.3
    proto-google-cloud-logging-v2==0.91.3

    and I'm running on a Linux Machine (Ubuntu 16.04.3 LTS)

    Exception:

    Exception in thread Consumer helper: consume bidirectional stream:
    Traceback (most recent call last):
    File "/home/user/anaconda3/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
    File "/home/user/anaconda3/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
    File "/home/user/anaconda3/lib/python3.6/site-packages/google/cloud/pubsub_v1/subscriber/_consumer.py", line 248, in _blocking_consume
    self._policy.on_exception(exc)
    File "/home/user/anaconda3/lib/python3.6/site-packages/google/cloud/pubsub_v1/subscriber/policy/thread.py", line 135, in on_exception
    raise exception
    File "/home/user/anaconda3/lib/python3.6/site-packages/google/cloud/pubsub_v1/subscriber/_consumer.py", line 234, in _blocking_consume
    for response in response_generator:
    File "/home/user/anaconda3/lib/python3.6/site-packages/grpc/_channel.py", line 348, in next
    return self._next()
    File "/home/user/anaconda3/lib/python3.6/site-packages/grpc/_channel.py", line 342, in _next
    raise self
    grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with (StatusCode.UNAVAILABLE, OS Error)>

  18. jkurz commented on Oct 7, 2017

    @jkurz
    jkurz
    on Oct 7, 2017
    More actions

    I just got this error while running a job on Google ML Engine.

    Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/root/.local/lib/python2.7/site-packages/object_detection/train.py", line 198, in <module> tf.app.run() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 44, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "/root/.local/lib/python2.7/site-packages/object_detection/train.py", line 194, in main worker_job_name, is_chief, FLAGS.train_dir) File "/root/.local/lib/python2.7/site-packages/object_detection/trainer.py", line 296, in train saver=saver) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/slim/python/slim/learning.py", line 793, in train train_step_kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/slim/python/slim/learning.py", line 546, in train_step if sess.run(train_step_kwargs['should_log']): File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 767, in run run_metadata_ptr) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 965, in _run feed_dict_string, options, run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1015, in _do_run target_list, options, run_metadata) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1035, in _do_call raise type(e)(node_def, op, message) UnavailableError: {"created":"@1507348685.699643392","description":"EOF","file":"external/grpc/src/core/lib/iomgr/tcp_posix.c","file_line":235,"grpc_status":14}
    

    Honestly not sure how to solve other than retry the job.

    Edit:

    And rerunning does not seem to help. Keep getting the same error.

  19. darofar commented on Oct 19, 2017

    @darofar
    darofar
    on Oct 19, 2017
    More actions

    Hi, i'm getting this error on PubSub consumer. I manage to get a "not so pretty" workaround.

    using a policy like this that replicates code for deadline_exceeded on google.cloud.pubsub_v1.subscriber.policy.thread.Policy.on_exception.

    from google.cloud.pubsub_v1.subscriber.policy.thread import Policy
    import grpc
    
    class UnavailableHackPolicy(Policy):
        def on_exception(self, exception):
            """
            There is issue on grpc channel that launch an UNAVAILABLE exception now and then. Until
            that issue is fixed we need to protect our consumer thread from broke.
            https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2683
            """
            unavailable = grpc.StatusCode.UNAVAILABLE
            if getattr(exception, 'code', lambda: None)() in [unavailable]:
                print("¡OrbitalHack! - {}".format(exception))
                return
            return super(UnavailableHackPolicy, self).on_exception(exception)
    

    On receive message function i have a code like

    subscriber = pubsub.SubscriberClient(policy_class=UnavailableHackPolicy)
    subscription_path = subscriber.subscription_path(project, subscription_name)
    subscriber.subscribe(subscription_path, callback=callback, flow_control=flow_control)
    

    Problem is that when the resource it is trully UNAVAILABLE we will be not aware.

    UPDATE: As noted here by @makrusak and here by @rclough. This hack cause high CPU usage leaving your consumer practically useless (available intermittently). So basically this changes one problem for another, your consumer does not die, but you will have to restart the worker that executes it often.

    Reacted by Mathieu Savy, Eric Braga, Bill Murphy, protoforge and Ryan C
  20. chemelnucfin commented on Nov 12, 2017

    @chemelnucfin
    chemelnucfin
    on Nov 12, 2017
    Contributor
    More actions

    I might be getting a similar problem on spanner trying to read ranges with index. I will need to test if it's my code or not.

  21. chemelnucfin
    added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Jan 9, 2018
  22. chemelnucfin
    assigned
    tseaver
    ,
    theacodes
    ,
    dhermes
    and
    chemelnucfin
    on Jan 11, 2018
  23. theacodes commented on Jan 11, 2018

    @theacodes
    theacodes
    on Jan 11, 2018
    Contributor
    More actions

    I think with all the work that @dhermes did on pubsub this should be resolved. I'm going to go ahead and close this, but if it's still reproducible with the latest version we can re-open.

    Reacted by Nathaniel Manista
  24. theacodes
    closed this as completedon Jan 11, 2018
  25. theacodes
    unassigned
    dhermes
    and
    chemelnucfin
    on Sep 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @theacodes
    theacodes
  • @tseaver
    tseaver

Labels

grpcpriority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.