-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
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.
Description
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, etcException:
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.
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.