Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-932248: Connection pool doesn't retry when using a disconnected connection #661

Closed
HarlemSquirrel opened this issue Oct 5, 2023 · 4 comments
Assignees
Labels
question Issue is a usage/other question rather than a bug

Comments

@HarlemSquirrel
Copy link

I am recording requests to Snowflake using PollyJS. This is working well except for one issue I have run into.

If I run a single test I can record and play back just fine.
If all requests are recorded I can play back just fine.
If all requests are recorded new, I can play back just fine.

However, if I have some recordings to play back but am missing one that I want to record, then that one throws "Unable to perform operation using terminated connection."

I suspect the issue is that Polly has disconnected so that the request can be passed through to Snowflake but the connection pool does not attempt to reconnect when it tries a disconnected connection.

Please answer these questions before submitting your issue.
In order to accurately debug the issue this information is required. Thanks!

  1. What version of NodeJS driver are you using?
    1.9.0

  2. What operating system and processor architecture are you using?
    Ubuntu x86_64

  3. What version of NodeJS are you using?
    (node --version and npm --version)
    v18.18.0
    9.8.1

  4. What are the component versions in the environment (npm list)?

5.Server version:* E.g. 1.90.1
You may get the server version by running a query:

SELECT CURRENT_VERSION();
  1. What did you do?

    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.

  2. What did you expect to see?

    What should have happened and what happened instead?

  3. Can you set logging to DEBUG and collect the logs?

    https://community.snowflake.com/s/article/How-to-generate-log-file-on-Snowflake-connectors

e.g
Add this to get standard output.

var snowflake = require('snowflake-sdk');
snowflake.configure(
{
  logLevel: 'trace'
});
  1. What is your Snowflake account identifier, if any? (Optional)
@HarlemSquirrel HarlemSquirrel added the bug Something isn't working label Oct 5, 2023
@github-actions github-actions bot changed the title Connection pool doesn't retry when using a disconnected connection SNOW-932248: Connection pool doesn't retry when using a disconnected connection Oct 5, 2023
@sfc-gh-dszmolka sfc-gh-dszmolka added question Issue is a usage/other question rather than a bug status-triage Issue is under initial triage status-information_needed Additional information is required from the reporter and removed bug Something isn't working labels Oct 6, 2023
@sfc-gh-dszmolka sfc-gh-dszmolka self-assigned this Oct 6, 2023
@sfc-gh-dszmolka
Copy link
Collaborator

sfc-gh-dszmolka commented Oct 6, 2023

Hi and thank you for raising this issue! At this point I'm wondering is this is really an unexpected behaviour from this library the Snowflake Node.JS driver ? I mean if a connection is already closed and thrown out of the pool and someone tries to use that exact connection, that doesn't sound too unexpected that it fails.

But, still might be something on our side so to troubleshoot further, can you please provide a reproducible scenario or script which when run, leads to this behaviour? You might need to increase the logging level in Polly as well, or if you have a reproduction outside of that tool, that is also fine.

edit: in addition to that, the driver dev team highlighted that testOnBorrow option for the pool might be relevant here. Since snowflake-sdk uses the generic-pool library under the hood (documentation ), those options also apply here. In particular:

testOnBorrow: boolean: should the pool validate resources before giving them to clients. Requires that factory.validate is specified.

can you try specifying it on pool creation and see if it helps?

@HarlemSquirrel
Copy link
Author

Hi David, thanks for getting back to me so quickly. Yeah, I would guess this is more of an issue between Polly and the generic-pool library. I was able to get this working better by setting min: 1.

This is a new app for us so it has not yet been deployed and it's the first app I think where we are using generic-pool so we'll likely be tweaking the settings as we go.

@HarlemSquirrel
Copy link
Author

I did see that there is a pool option testOnBorrow that might help with this as well but haven't tried it yet.

@sfc-gh-dszmolka
Copy link
Collaborator

hey Kevin thanks for sharing your solution, might be useful for others as well! for now, I'm marking this one as closed but please feel free to comment if you suspect a bug / misbehaviour of this library and we can take it further.

@sfc-gh-dszmolka sfc-gh-dszmolka removed status-triage Issue is under initial triage status-information_needed Additional information is required from the reporter labels Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issue is a usage/other question rather than a bug
Projects
None yet
Development

No branches or pull requests

2 participants