| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
This pull request introduces try-finally blocks in both the synchronous and asynchronous implementations of execute_update and batch_update within the Google Cloud Spanner transaction modules. This ensures that the transaction lock is safely released if an error occurs during an inline begin. Unit tests have been added to verify that the lock is released upon failure, and mockserver has been added to the noxfile. There are no review comments, so I have no feedback to provide.
Sorry, something went wrong.
When execute_update() or batch_update() starts an inline begin (transaction_id is None), it acquires self._lock while waiting for the transaction ID from the server. If that request failed with an error, the lock was never released. This was a latent bug in _async/transaction.py that became an active deadlock when async/sync parity was recently restored in snapshot.py: reintroducing _wait_for_transaction_begin() meant subsequent queries in the same transaction now try to acquire self._lock and hang. Wrap the request execution in try...finally in _async/transaction.py and regenerate sync transaction.py so self._lock is always released. Also: - Add unit tests for failed inline begin in both async and sync clients. - Add a GitHub Actions workflow to run Spanner mock server tests in CI. - Include the mockserver session in default local Nox runs.
| Back | FazBrowse Home | New Git URL |
When execute_update() or batch_update() starts an inline begin (transaction_id is None), it acquires self._lock while waiting for the transaction ID from the server. If that request failed with an error, the lock was never released.
This was a latent bug in _async/transaction.py that became an active deadlock when async/sync parity was recently restored in snapshot.py: reintroducing _wait_for_transaction_begin() meant subsequent queries in the same transaction now try to acquire self._lock and hang.
Wrap the request execution in try...finally in _async/transaction.py and regenerate sync transaction.py so self._lock is always released.
Also: