Skip to content

spanner: transaction fails with Session not found error #1527

@110y

Description

@110y

Client

Spanner: v0.37.4 (But as far as I know, it also occurs when we use latest version)

Describe Your Environment

Alpine Docker on GKE

Expected Behavior

If possible, this client library should retries a transaction when it fails with Session not found error.

Actual Behavior

We sometimes get the Session not found errors.
This client library retries transactions only when the Abort error occurred, so when taken session is not active, it just returns the NotFound error to callers without retrying.

  • sh, err = c.idleSessions.takeWriteSession(ctx)
    if err != nil {
    // If session retrieval fails, just fail the transaction.
    return err
    }
  • // Only retry on ABORTED.
    if isAbortErr(funcErr) {
    // Aborted, do exponential backoff and continue.
    b, ok := extractRetryDelay(funcErr)
    if !ok {
    b = backoff.DefaultBackoff.Delay(retryCount)
    }
    trace.TracePrintf(ctx, nil, "Backing off after ABORTED for %s, then retrying", b)
    select {
    case <-ctx.Done():
    return errContextCanceled(ctx, funcErr)
    case <-time.After(b):
    }
    retryCount++
    continue
    }

Since this library creates the pool of the sessions, I think it should retry failed transactions caused by Session not found by taking another session. But are there any problems to take another session from the pool?

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the Spanner API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions