You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OK, my theory is that the clock resolution on the Appveyor Windows host is weird, such that successive calls to datetime.datetime.utcnow() are returning the same time, which makes the priority queue switch to the mock session to distinguish between entries.
I can work around the test failure by making _Session total-orderable: likely I need to ensure that the "real" Session class can be ordered, too.
It seems very possible that the culprit is a unit test that talks to the backend on accident
I don't think so in this case: the database and spanner_api objects are completely mocked out. I think what is happening is that the Appveyor machine is slow / loaded enough such that the very low retry timeout (0.01 seconds) is cutting the retry loop off before the first retry. We can try raising that timeout (maybe 50 ms vs. 10?)
run_with_transaction(callback) sets up a transaction and passes it to callback, and afterwards attempts to commit the transaction. While the commit back-end raises ABORT, and the user-supplied timeout has not expired, it retries.
In order to exercise the retry loop without adding too much delay, I set the timeout to 10 msec. I didn't think it would be possible for the following to take longer than that:
The run_with_transaction method keeps retrying until the user-supplied timeout expires. In the failing test, the timeout expired unexpectedly during the first run of the callback, which led to the assertion failure: there was no retry.
Activity
dhermes commentedon Feb 16, 2017
@tseaver Having a not-green build is making me itchy. Are you planning on checking this out?
tseaver commentedon Feb 16, 2017
I will start on this issue today. I have zero clue why the following would fail on Python 3.4 on Windows but not on Linux:
(There is an identical failure in
unit_tests.test_pool.TestTransactionPingingPool testMethod=test_put_full).tseaver commentedon Feb 17, 2017
OK, my theory is that the clock resolution on the Appveyor Windows host is weird, such that successive calls to
datetime.datetime.utcnow()are returning the same time, which makes the priority queue switch to the mock session to distinguish between entries.I can work around the test failure by making
_Sessiontotal-orderable: likely I need to ensure that the "real"Sessionclass can be ordered, too.dhermes commentedon Feb 18, 2017
Victory: https://ci.appveyor.com/project/GoogleCloudPlatform/google-cloud-python/build/1.0.1079.master
dhermes commentedon Feb 21, 2017
A "sporadic" failure: https://ci.appveyor.com/project/GoogleCloudPlatform/google-cloud-python/build/1.0.1081.master/job/rl8ms6nhw1gibeb1
@tseaver It seems very possible that the culprit is a unit test that talks to the backend on accident
tseaver commentedon Feb 21, 2017
I don't think so in this case: the database and spanner_api objects are completely mocked out. I think what is happening is that the Appveyor machine is slow / loaded enough such that the very low retry timeout (0.01 seconds) is cutting the retry loop off before the first retry. We can try raising that timeout (maybe 50 ms vs. 10?)
dhermes commentedon Feb 21, 2017
Why don't we also mock the retry?
tseaver commentedon Feb 21, 2017
The whole point of that test is to ensure that
run_with_transactiondoes retry on a gRPC ABORT.dhermes commentedon Feb 21, 2017
No worries. Just want to make sure the test is deterministic.
tseaver commentedon Feb 21, 2017
run_with_transaction(callback)sets up a transaction and passes it tocallback, and afterwards attempts to commit the transaction. While thecommitback-end raisesABORT, and the user-supplied timeout has not expired, it retries.In order to exercise the retry loop without adding too much delay, I set the timeout to 10 msec. I didn't think it would be possible for the following to take longer than that:
(along with the call to
txn.commit(), which then delegates to the mocked-outspanner_api, raising anAbort).I didn't count on the fact that a loaded CI host might make that assumption.
dhermes commentedon Feb 21, 2017
Why does the timeout play any role?
tseaver commentedon Feb 21, 2017
The
run_with_transactionmethod keeps retrying until the user-supplied timeout expires. In the failing test, the timeout expired unexpectedly during the first run of the callback, which led to the assertion failure: there was no retry.dhermes commentedon Feb 22, 2017
Got it. Can we mock out the part that decides when to retry so it doesn't rely on elapsed time (which is what makes it nondeterministic)?
tseaver commentedon Feb 22, 2017
Have a look at the MUT (
Session.run_in_transaction) is the bit that makes the decision.dhermes commentedon Feb 22, 2017
@tseaver Maybe that's an indication that a re-factor would be useful?
Ensure that mocked '_Spanner' instances are orderable.
Ensure that mocked '_Spanner' instances are orderable.