Skip to content

firestore-admin: runAsyncTransaction() throwing exception never stops retrying  #667

@icoloma

Description

@icoloma

OS: Linux
openjdk version 11.0.11
firebase-admin:7.3.0
google-cloud-firestore:2.5.0

A transaction with the local emulator that always throws an exception is constantly retried and never times out:

var options = FirestoreOptions
  .getDefaultInstance()
  .toBuilder()
  .setProjectId(Config.GOOGLE_CLOUD_PROJECT)
  .setEmulatorHost("localhost:9000")
  .setCredentials(new FirestoreOptions.EmulatorCredentials());
var firestore = options.build().getService();

firestore
  .runAsyncTransaction(
    tx -> {
      log.info("Hello world");
      throw new RuntimeException("Fail");
      // return ApiFutures.immediateFuture("OK");
    }
  )
  .get();

If I replace the throw statement with return, the invocation finishes successfully.

I also tried adding the following, and it didn't work:

options.setRetrySettings(
  RetrySettings
    .newBuilder()
    .setMaxAttempts(1)
    .setTotalTimeout(Duration.ofSeconds(2))
    .setInitialRpcTimeout(Duration.ofSeconds(2))
    .setMaxRpcTimeout(Duration.ofSeconds(2))
    .build()
)

I expected the following:

  • Transaction retries to expire after 60 seconds
  • With the second example, the transaction to stop retrying after one failed attempt or 2 seconds passed.

Did I miss something?

Metadata

Metadata

Assignees

Labels

api: firestoreIssues related to the googleapis/java-firestore API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions