Skip to content

Conversation

@olavloite
Copy link
Contributor

The session pool should never try to create a negative number of sessions. Especially the _fill method could try that, as it would create this.options.min! - this.size sessions. That works well for an empty session pool, but not for one that has already been filled, and can cause the _pending value to become negative.

It might be that the _fill method could cause the strange statistics that we see in #1465 if the following happens:

  1. _fill is called after the session pool has been initialized (i.e. there is at least 1 session in the pool)
  2. _pending is increased with a negative number, potentially causing it to become negative:
    this._pending += needed;
  3. The loop for creating sessions is never executed, which also means that _pending is never updated when the sessions are created or the creation fails.

Updates #1465

@olavloite olavloite requested review from a team as code owners September 9, 2021 09:02
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Sep 9, 2021
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/nodejs-spanner API. label Sep 9, 2021
@olavloite olavloite added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 9, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 9, 2021
@skuruppu skuruppu merged commit 13f5153 into master Sep 10, 2021
@skuruppu skuruppu deleted the never-create-negative-sessions branch September 10, 2021 02:10
gcf-merge-on-green bot pushed a commit that referenced this pull request Sep 10, 2021
asthamohta pushed a commit to asthamohta/nodejs-spanner that referenced this pull request Sep 21, 2021
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
asthamohta pushed a commit to asthamohta/nodejs-spanner that referenced this pull request Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the googleapis/nodejs-spanner API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants