Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Transaction is left open when error happens in Datastore API #2297

Copy link
Copy link

Description

@dmho418
Issue body actions

This one is hard to reproduce, but I noticed that when using a transaction with a with statement and an error happens inside the transaction itself (a 500 error for example), it appears that the transaction is left open.

with self.client.transaction():
  # do stuff

# create entities, put, put_multi, etc

Exception:

Traceback (most recent call last):
  File "my_client.py", line 190, in do_stuff
    with self.client.transaction():
  File "site-packages/gcloud/datastore/batch.py", line 275, in __enter__
    self.begin()
  File "site-packages/gcloud/datastore/transaction.py", line 131, in begin
    self._id = self.connection.begin_transaction(self.project)
  File "site-packages/gcloud/datastore/connection.py", line 307, in begin_transaction
    _datastore_pb2.BeginTransactionResponse)
  File "site-packages/gcloud/datastore/connection.py", line 124, in _rpc
    data=request_pb.SerializeToString())
  File "site-packages/gcloud/datastore/connection.py", line 98, in _request
    raise make_exception(headers, error_status.message, use_json=False)
InternalServerError: 500 internal error.

After the exception, any operations to the Datastore using the same client have no effect, and no error is reported.
So my guess is that for some reason the transaction was left open and the changes are never committed.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.