Skip to content

Spanner: ResultSet from session keep-alive request is not closed. #6330

Description

@sebright2

When I ran an application using google-cloud-spanner 1.30.0 with opencensus-impl 0.23.0, I noticed this log message:

io.opencensus.implcore.trace.RecordEventsSpanImpl finalize
SEVERE: Span CloudSpannerOperation.ExecuteStreamingQuery is GC'ed without being ended.

It looks like this is caused by the session keep-alive request:

private void keepAlive() {
markUsed();
delegate
.singleUse(TimestampBound.ofMaxStaleness(60, TimeUnit.SECONDS))
.executeQuery(Statement.newBuilder("SELECT 1").build())
.next();
}

If I understand correctly, the ResultSet contains a ResumableStreamIterator, which contains the span representing the request. The issue is that keepAlive doesn't call close on the ResultSet, so the span is never ended. Calling close on the ResultSet seems to fix the issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions