GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Spanner: RESOURCE_EXHAUSTED No session available in the pool. · Issue #3786 · googleapis/google-cloud-java

Spanner: RESOURCE_EXHAUSTED No session available in the pool.  #3786

New issue
Copy link
New issue
Copy link
Closed
Closed
Spanner: RESOURCE_EXHAUSTED No session available in the pool. #3786
Copy link
Assignees
snehashah16
Labels
api: spannerIssues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue.

Description

@lascarayf
lascarayf
opened on Oct 8, 2018
Issue body actions

I am using the Spanner client library for Java and i configure the client using Spring (Java 10 and Docker)

After a while, the application start to log the following message but i don't understand why. The application concurrency is minimal. It's seem the sessions aren't reused.

I monitor the session with Stackdriver and they are below 20.

If i remove setFailIfPoolExhausted the applicacion hang instead of throwing exception RESOURCE_EXHAUSTED.

RESOURCE_EXHAUSTED: No session available in the pool. Maximum number of sessions in the pool can be overridden by invoking SessionPoolOptions#Builder#setMaxSessions. Client can be made to block rather than fail by setting SessionPoolOptions#Builder#setBlockIfPoolExhausted.

@Configuration
public class SpannerConfig {

    @Value("${datasource.instanceId}")
    private String instance;

    @Value("${datasource.databaseId}")
    private String database;

    @Bean
    public Spanner spannerService() throws IOException {

        SessionPoolOptions sessionPoolOptions = SessionPoolOptions.newBuilder()
                .setFailIfPoolExhausted()
                .setMinSessions(5)
                .setMaxSessions(100)
                .build();

        SpannerOptions options = SpannerOptions.newBuilder()
                .setSessionPoolOption(sessionPoolOptions)
                .build();

        return options.getService();
    }


    @Bean
    public DatabaseClient spannerClient(Spanner spannerService) {
        DatabaseId databaseId = DatabaseId.of(spannerService.getOptions().getProjectId(), instance, database);
        return spannerService.getDatabaseClient(databaseId);
    }
}

Activity

  1. lascarayf commented on Oct 8, 2018

    @lascarayf
    lascarayf
    on Oct 8, 2018
    Author
    More actions

    i add the stackoverflow link
    https://stackoverflow.com/questions/52695111/resource-exhausted-no-session-available-in-the-pool

  2. JustinBeckwith
    added
    triage meI really want to be triaged.
    on Oct 9, 2018
  3. sduskis
    added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    priority: p2Moderately-important priority. Fix may not be included in next release.
    api: spannerIssues related to the Spanner API.
    and removed
    triage meI really want to be triaged.
    on Oct 9, 2018
  4. avaisberg commented on Oct 10, 2018

    @avaisberg
    avaisberg
    on Oct 10, 2018
    More actions

    I have the same error. I dont known why.

    News?

    Thanks!

  5. snehashah16
    added
    type: questionRequest for information or clarification. Not an issue.
    and removed
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Oct 22, 2018
  6. snehashah16 commented on Oct 22, 2018

    @snehashah16
    snehashah16
    on Oct 22, 2018
    Contributor
    More actions

    this has been answered on Stack Overflow

    short answer:
    Try putting this in a try-with-resources block:
    try (ResultSet rs = spannerClient.singleUse().executeQuery(statement)) { ... }

  7. snehashah16
    closed this as completedon Oct 22, 2018
  8. JustinBeckwith
    assigned
    snehashah16
    on Feb 1, 2021
  9. suztomo
    added a commit that references this issue on Mar 9, 2026

    chore(deps): update dependency com.google.cloud:google-cloud-bigquery…

    c7b50fe
  10. lqiu96
    added a commit that references this issue on Mar 20, 2026

    chore(deps): update dependency com.google.cloud:google-cloud-bigquery…

    ce16904
  11. chingor13
    added 2 commits that reference this issue on Mar 24, 2026

    feat: add cloudbuild config to publish image via AR Exit Gate (#3786)

    c3b0bfa

    chore(main): release 2.58.0 (#3787)

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

Metadata

Metadata

Assignees

  • @snehashah16
    snehashah16

Labels

api: spannerIssues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.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

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.