Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

samples.samples.autocommit_test: test_enable_autocommit_mode failed #211

@flaky-bot

Description

@flaky-bot

This test failed!

To configure my behavior, see the Build Cop Bot documentation.

If I'm commenting on this issue too often, add the buildcop: quiet label and
I will stop commenting.


commit: 283ea3d
buildURL: Build Status, Sponge
status: failed

Test output
args = (session: "projects/python-docs-samples-tests/instances/test-instance-19c3188856/databases/test-db-3a2148483f/sessions... id: "AN4G3x_1FC_JoSPbvON4cGqzdsYDC6Qxcz-J2g"
}
sql: "SELECT * FROM Singers WHERE SingerId = 13"
params {
}
seqno: 1
,)
kwargs = {'metadata': [('google-cloud-resource-prefix', 'projects/python-docs-samples-tests/instances/test-instance-19c3188856/...IDJU70w'), ('x-goog-api-client', 'django_spanner/2.2.0a1 gl-python/3.6.10 grpc/1.34.1 gax/1.25.0')], 'timeout': 3600.0}
result = <_MultiThreadedRendezvous of RPC that terminated with:
	status = StatusCode.ABORTED
	details = "Transaction was aborte...","file":"src/core/lib/surface/call.cc","file_line":1062,"grpc_message":"Transaction was aborted.","grpc_status":10}"
>
prefetch_first = True
@general_helpers.wraps(callable_)
def error_remapped_callable(*args, **kwargs):
    try:
        result = callable_(*args, **kwargs)
        # Auto-fetching the first result causes PubSub client's streaming pull
        # to hang when re-opening the stream, thus we need examine the hacky
        # hidden flag to see if pre-fetching is disabled.
        # https://github.com/googleapis/python-pubsub/issues/93#issuecomment-630762257
        prefetch_first = getattr(callable_, "_prefetch_first_result_", True)
      return _StreamingResponseIterator(result, prefetch_first_result=prefetch_first)

.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:150:


self = <google.api_core.grpc_helpers._StreamingResponseIterator object at 0x7ff45b36f860>
wrapped = <_MultiThreadedRendezvous of RPC that terminated with:
status = StatusCode.ABORTED
details = "Transaction was aborte...","file":"src/core/lib/surface/call.cc","file_line":1062,"grpc_message":"Transaction was aborted.","grpc_status":10}"

prefetch_first_result = True

def __init__(self, wrapped, prefetch_first_result=True):
    self._wrapped = wrapped

    # This iterator is used in a retry context, and returned outside after init.
    # gRPC will not throw an exception until the stream is consumed, so we need
    # to retrieve the first result, in order to fail, in order to trigger a retry.
    try:
        if prefetch_first_result:
          self._stored_first_result = six.next(self._wrapped)

.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:73:


self = <_MultiThreadedRendezvous of RPC that terminated with:
status = StatusCode.ABORTED
details = "Transaction was aborte...","file":"src/core/lib/surface/call.cc","file_line":1062,"grpc_message":"Transaction was aborted.","grpc_status":10}"

def __next__(self):
  return self._next()

.nox/py-3-6/lib/python3.6/site-packages/grpc/_channel.py:416:


self = <_MultiThreadedRendezvous of RPC that terminated with:
status = StatusCode.ABORTED
details = "Transaction was aborte...","file":"src/core/lib/surface/call.cc","file_line":1062,"grpc_message":"Transaction was aborted.","grpc_status":10}"

def _next(self):
    with self._state.condition:
        if self._state.code is None:
            event_handler = _event_handler(self._state,
                                           self._response_deserializer)
            operating = self._call.operate(
                (cygrpc.ReceiveMessageOperation(_EMPTY_FLAGS),),
                event_handler)
            if operating:
                self._state.due.add(cygrpc.OperationType.receive_message)
        elif self._state.code is grpc.StatusCode.OK:
            raise StopIteration()
        else:
            raise self

        def _response_ready():
            return (
                self._state.response is not None or
                (cygrpc.OperationType.receive_message not in self._state.due
                 and self._state.code is not None))

        _common.wait(self._state.condition.wait, _response_ready)
        if self._state.response is not None:
            response = self._state.response
            self._state.response = None
            return response
        elif cygrpc.OperationType.receive_message not in self._state.due:
            if self._state.code is grpc.StatusCode.OK:
                raise StopIteration()
            elif self._state.code is not None:
              raise self

E grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
E status = StatusCode.ABORTED
E details = "Transaction was aborted."
E debug_error_string = "{"created":"@1611137373.570131133","description":"Error received from peer ipv4:74.125.20.95:443","file":"src/core/lib/surface/call.cc","file_line":1062,"grpc_message":"Transaction was aborted.","grpc_status":10}"
E >

.nox/py-3-6/lib/python3.6/site-packages/grpc/_channel.py:803: _MultiThreadedRendezvous

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

capsys = <_pytest.capture.CaptureFixture object at 0x7ff45b4aaac8>
database = <google.cloud.spanner_v1.database.Database object at 0x7ff45b3f5f60>

def test_enable_autocommit_mode(capsys, database):
    connection = connect(INSTANCE_ID, DATABASE_ID)
    cursor = connection.cursor()

    with mock.patch(
        "google.cloud.spanner_dbapi.connection.Cursor", return_value=cursor,
    ):
      autocommit.enable_autocommit_mode(INSTANCE_ID, DATABASE_ID)

autocommit_test.py:59:


autocommit.py:39: in enable_autocommit_mode
cursor.execute("""SELECT * FROM Singers WHERE SingerId = 13""")
../../google/cloud/spanner_dbapi/cursor.py:207: in execute
self._itr = PeekIterator(self._result_set)
../../google/cloud/spanner_dbapi/utils.py:38: in init
head = next(itr_src)
../../google/cloud/spanner_v1/streamed.py:139: in iter
self._consume_next()
../../google/cloud/spanner_v1/streamed.py:113: in _consume_next
response = six.next(self._response_iterator)
../../google/cloud/spanner_v1/snapshot.py:53: in _restart_on_unavailable
iterator = restart()
../../google/cloud/spanner_v1/services/spanner/client.py:881: in execute_streaming_sql
response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/gapic_v1/method.py:145: in call
return wrapped_func(*args, **kwargs)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/timeout.py:102: in func_with_timeout
return func(*args, **kwargs)
.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:152: in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)


value = None
from_value = <_MultiThreadedRendezvous of RPC that terminated with:
status = StatusCode.ABORTED
details = "Transaction was aborte...","file":"src/core/lib/surface/call.cc","file_line":1062,"grpc_message":"Transaction was aborted.","grpc_status":10}"

???
E google.api_core.exceptions.Aborted: 409 Transaction was aborted.

:3: Aborted

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: spannerIssues related to the googleapis/python-spanner API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.samplesIssues that are directly related to samples.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