Title: Transaction is left open when error happens in Datastore API · Issue #2297 · googleapis/google-cloud-python · GitHub
Open Graph Title: Transaction is left open when error happens in Datastore API · Issue #2297 · googleapis/google-cloud-python
X Title: Transaction is left open when error happens in Datastore API · Issue #2297 · googleapis/google-cloud-python
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...
Open Graph 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 tr...
X 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 tr...
Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/2297
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Transaction is left open when error happens in Datastore API","articleBody":"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.\n\n``` python\nwith self.client.transaction():\n # do stuff\n\n# create entities, put, put_multi, etc\n```\n\nException:\n\n``` python\nTraceback (most recent call last):\n File \"my_client.py\", line 190, in do_stuff\n with self.client.transaction():\n File \"site-packages/gcloud/datastore/batch.py\", line 275, in __enter__\n self.begin()\n File \"site-packages/gcloud/datastore/transaction.py\", line 131, in begin\n self._id = self.connection.begin_transaction(self.project)\n File \"site-packages/gcloud/datastore/connection.py\", line 307, in begin_transaction\n _datastore_pb2.BeginTransactionResponse)\n File \"site-packages/gcloud/datastore/connection.py\", line 124, in _rpc\n data=request_pb.SerializeToString())\n File \"site-packages/gcloud/datastore/connection.py\", line 98, in _request\n raise make_exception(headers, error_status.message, use_json=False)\nInternalServerError: 500 internal error.\n```\n\nAfter the exception, any operations to the Datastore using the same client have no effect, and no error is reported.\nSo my guess is that for some reason the transaction was left open and the changes are never committed.\n","author":{"url":"https://github.com/dmho418","@type":"Person","name":"dmho418"},"datePublished":"2016-09-12T03:24:10.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/2297/google-cloud-python/issues/2297"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8edc68f8-a375-17b6-d477-f01dfb346a3a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ADFA:390894:C4236:10F05F:6A4D2F0C |
| html-safe-nonce | 449c6d5faca2f57346c157374127871450d66882bd799fde51a75d5fc7899143 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBREZBOjM5MDg5NDpDNDIzNjoxMEYwNUY6NkE0RDJGMEMiLCJ2aXNpdG9yX2lkIjoiODE2MjIwMjMyNjk0Mjk1MzIyOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | dc115abaf917992ee89946034716d720eb8c32ab495561ebec3d163500f2ea26 |
| hovercard-subject-tag | issue:176287431 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/google-cloud-python/2297/issue_layout |
| twitter:image | https://opengraph.githubassets.com/12f1b39e971721c89d4c894c0d2e78c7bda8cc3a0c02fdb17d3bd1a6344032c2/googleapis/google-cloud-python/issues/2297 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/12f1b39e971721c89d4c894c0d2e78c7bda8cc3a0c02fdb17d3bd1a6344032c2/googleapis/google-cloud-python/issues/2297 |
| og:image:alt | 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 tr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dmho418 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 92571a8944142227b7e19cd10918b1ddd06e5066c1ad5bc7e4769cf6140a87e6 |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/google-cloud-python git https://github.com/googleapis/google-cloud-python.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 16316451 |
| octolytics-dimension-repository_nwo | googleapis/google-cloud-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 16316451 |
| octolytics-dimension-repository_network_root_nwo | googleapis/google-cloud-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 93f17a978ee60bc4668e1d7b90e6bd2d622261fd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width