0
votes

We are using spanner emulator in our sandbox environment. From time to time it happens that some transaction hangs out what is causing following error:

Caused by: com.google.api.gax.rpc.AbortedException: io.grpc.StatusRuntimeException: ABORTED: Transaction 37431 aborted due to active transaction 27078. The emulator only supports one transaction at a time.

The only way we found to make the spanner emulator working again after such an issue is to recreate a database (delete and create) what is quite annoying.

I've tried to kill all sessions listed by gcloud spanner databases sessions list --database=db --instance=sand but it is not helping.

Is there any way to abort/rollback a hanging transaction in spanner emulator?

1

1 Answers

0
votes

Executing a Rollback RPC for transaction 27078 should do that. That being said, that is not necessarily straightforward:

  1. Which client library / driver are you using? From the error message you posted, it seems to be Java. In that case you could try to construct a RollbackRequest and call the Rollback method in the generated client manually.
  2. How/when does this happen? Normally, the Java client should automatically rollback any failed transaction. Or are you using some other driver than the regular Java client?