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 — Add a test which provokes abort-during-read during 'run_in_transaction'. by tseaver · Pull Request #3663 · googleapis/google-cloud-python

Conversation

@tseaver

@tseaver tseaver commented Jul 24, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Uses #3615 as a base. ca441f7 is the only change from that PR.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tseaver tseaver added api: spanner Issues related to the Spanner API. testing labels Jul 24, 2017
@tseaver
tseaver requested review from dhermes and lukesneeringer July 24, 2017 21:58
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 24, 2017
@tseaver tseaver added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jul 24, 2017
@tseaver

tseaver commented Jul 24, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

This test can deadlock: I got interrupted while debugging and blew my stack. :(

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tseaver

tseaver commented Jul 25, 2017

Copy link
Copy Markdown
Contributor Author

@dhermes, @bjwatson, @lukesneeringer OK, I have the test passing, but to do so I have to straddle the fact that the GAPIC / gRPC bits sometimes raise a _Rendezvous w/ status code ABORTED, and sometimes a GaxError with such a _Rendezvous as their cause. I think the APIs should raise one or the other, not a mix-and-match.

Specifics:

  • ABORTED returned from the server during a Read API call is raised as a _Rendezvous.
    ABORTEDreturned from the server during aCommitAPI call is raised as aGaxError`.

My hack to get the read-abort bit passing:

@@ -312,7 +334,12 @@ def _delay_until_retry(exc, deadline):
     :type deadline: float
     :param deadline: maximum timestamp to continue retrying the transaction.
     """
-    if exc_to_code(exc.cause) != StatusCode.ABORTED:
+    if isinstance(exc, GrpcRendezvous):
+        cause = exc
+    else:
+        cause = exc.cause
+
+    if exc_to_code(cause) != StatusCode.ABORTED:
         raise
 
     now = time.time()
@@ -320,7 +347,7 @@ def _delay_until_retry(exc, deadline):
     if now >= deadline:
         raise
 
-    delay = _get_retry_delay(exc)
+    delay = _get_retry_delay(cause)
     if delay is not None:
 
         if now + delay > deadline:
@@ -330,7 +357,7 @@ def _delay_until_retry(exc, deadline):
 # pylint: enable=misplaced-bare-raise
 
 
-def _get_retry_delay(exc):
+def _get_retry_delay(cause):
     """Helper for :func:`_delay_until_retry`.
 
     :type exc: :class:`google.gax.errors.GaxError`
@@ -339,7 +366,7 @@ def _get_retry_delay(exc):
     :rtype: float
     :returns: seconds to wait before retrying the transaction.
     """
-    metadata = dict(exc.cause.trailing_metadata())
+    metadata = dict(cause.trailing_metadata())
     retry_info_pb = metadata.get('google.rpc.retryinfo-bin')
     if retry_info_pb is not None:
         retry_info = RetryInfo()
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tseaver

tseaver commented Jul 25, 2017

Copy link
Copy Markdown
Contributor Author

Turns out my issue is the same as #3562.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tseaver tseaver mentioned this pull request Jul 25, 2017
gRPC _Rendezvous w/ 'ABORTED' status propagated from 'Session.run_in_transaction' #3562
Closed
@tseaver
tseaver force-pushed the spanner-systest-txn_read_abort branch from ca441f7 to f916edc Compare July 28, 2017 19:40
@tseaver tseaver added the status: blocked Resolving the issue is dependent on other work. label Jul 28, 2017
@tseaver

tseaver commented Jul 28, 2017

Copy link
Copy Markdown
Contributor Author

I've rebased, fixed the deadlock / hang, and added a separate commit (f916edc) with my workaround for #3562 so that I can verify the tests pass on Circle. I propose waiting for a real fix and then removing that commit.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tseaver

tseaver commented Jul 28, 2017

Copy link
Copy Markdown
Contributor Author

The test failure is for coverage of branches added in the to-be-backed-out commit (f916edc).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@theacodes

theacodes commented Aug 7, 2017

Copy link
Copy Markdown
Contributor

@tseaver once #3738 is in, you can use google.api.core.exceptions.from_grpc_exception to map the grpc.RpcError to a Google API exception. You shouldn't need to catch _Rendezvous directly, instead, catch grpc.RpcError or grpc.Call (if you need the metadata directly).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bjwatson bjwatson added release blocking Required feature/issue must be fixed prior to next release. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. and removed status: blocked Resolving the issue is dependent on other work. labels Aug 7, 2017
@bjwatson

bjwatson commented Aug 8, 2017

Copy link
Copy Markdown

@tseaver I removed the blocked label since it looks like @jonparrott unblocked this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tseaver

tseaver commented Aug 8, 2017

Copy link
Copy Markdown
Contributor Author

@jonparrott Note that for the ABORT error, I'm not propagating the error, but using it to trigger a retry (I do need access to the trailing metadata to pick out the retry interval).

@bjwatson Am I still supposed to be catching GaxError as well as grpc.Call here?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@theacodes

theacodes commented Aug 8, 2017

Copy link
Copy Markdown
Contributor

@tseaver yes, in this case catch GaxError and grpc.Call.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tseaver

tseaver commented Aug 8, 2017

Copy link
Copy Markdown
Contributor Author

@jonparrott Why are we not fixing the streaming iterator stuff to return only one kind of error?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@theacodes

theacodes commented Aug 8, 2017

Copy link
Copy Markdown
Contributor

@tseaver we are, but it's O(weeks) away, and changing this PR to catch grpc.Call instead of GrpcRendezvous is a fine compromise for now- in the near term, it'll unblock spanner. Once google.api.core.grpc exists and is used by gapic, it will not raise this error which will mean a small change will need to be made here (simplifying this to just catch a google.api.core.exception subclass).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tseaver added 2 commits August 9, 2017 17:33
@tseaver
Add a test which provokes abort-during-read during 'run_in_transaction'.
729a757
@tseaver
Workaround for #3562.
cf48b5e
@tseaver

tseaver commented Aug 9, 2017

Copy link
Copy Markdown
Contributor Author

@jonparrott Note that one cannot catch grpc.Call (it doesn't derive from BaseException).

Given that the change is intended to be temporary, I will merge with a # pragma: NO COVER on the branch for if isinstance(exc, GrpcRendezvous), and add an issue to remove that once the underling normalization fix has rolled out.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tseaver
tseaver force-pushed the spanner-systest-txn_read_abort branch from f916edc to cf48b5e Compare August 9, 2017 22:16
@tseaver tseaver mentioned this pull request Aug 9, 2017
Remove workaround for #3562 from 'session._delay_unti_retry` #3781
Closed
@tseaver
tseaver merged commit 1fcc1a4 into master Aug 10, 2017
@tseaver
tseaver deleted the spanner-systest-txn_read_abort branch August 10, 2017 01:19
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 21, 2017
@tseaver @landrito
Add a test which provokes abort-during-read during 'run_in_transacti…
7bd8764
…on'. (googleapis#3663)
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 22, 2017
@tseaver @landrito
Add a test which provokes abort-during-read during 'run_in_transacti…
4c55a81
…on'. (googleapis#3663)
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 22, 2017
@tseaver @landrito
Add a test which provokes abort-during-read during 'run_in_transacti…
94ce6dd
…on'. (googleapis#3663)
@dhermes dhermes mentioned this pull request Aug 24, 2017
Upgrading Spanner to 0.27.0 after google-cloud-core update. #3873
Merged
parthea pushed a commit that referenced this pull request Mar 9, 2026
@tseaver
Add a test which provokes abort-during-read during 'run_in_transacti…
1aa58dd
…on'. (#3663)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@lukesneeringer lukesneeringer Awaiting requested review from lukesneeringer
@dhermes dhermes Awaiting requested review from dhermes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

api: spanner Issues related to the Spanner API. cla: yes This human has signed the Contributor License Agreement. do not merge Indicates a pull request not ready for merge, due to either quality or timing. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. release blocking Required feature/issue must be fixed prior to next release. testing

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@tseaver @theacodes @bjwatson @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.