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-1447051: Unhandled resources after creating a Connection prevents process from terminating #846

Open
igor-ruivo opened this issue May 24, 2024 · 4 comments
Assignees
Labels
bug Something isn't working status-triage_done Initial triage done, will be further handled by the driver team

Comments

@igor-ruivo
Copy link

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.10.1

  2. What operating system and processor architecture are you using?
    macOS Sonoma 14.4.1

  3. What version of NodeJS are you using?
    (node --version and npm --version)
    v20.10.0

  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?
    Boilerplate app:
import { createConnection } from 'snowflake-sdk';

void (async () => {
    const connection = createConnection({
        authenticator: 'EXTERNALBROWSER',
        account: '...',
        username: '',
        password: undefined,
        role: '...',
        warehouse: '...'
    });

    await connection.connectAsync((err) => {
        if (err instanceof Error) {
            throw err;
        }

        console.log('Successfully connected');
    });

    connection.destroy(() => console.log('Destroyed connection!'));

    console.log('Done. Why am I hanging?');
})();

Running this code, you can see that the process hangs at the very end.
I'm also destroying the connection (although I shouldn't need to do it), but the result is still the same.

After a minute or so my process actually terminates, but this sometimes doesn't happen in Production. The hang may last for hours or forever (for all I know).

Using a tool like why-is-node-running shoes multiple handles referring the snowflake-sdk and its axios usage.

  1. What did you expect to see?

    I would expect the process to terminate.

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

    CALL POST with timeout 90000: .../login-request?requestId=...
    CALL POST with timeout 90000: .../delete=true?requestId=...

  3. What is your Snowflake account identifier, if any? (Optional)

@igor-ruivo igor-ruivo added the bug Something isn't working label May 24, 2024
@github-actions github-actions bot changed the title Unhandled resources after creating a Connection prevents process from terminating SNOW-1447051: Unhandled resources after creating a Connection prevents process from terminating May 24, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka self-assigned this May 27, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka added the status-triage Issue is under initial triage label May 27, 2024
@sfc-gh-dszmolka
Copy link
Collaborator

hi - thanks for raising this and all the details ! will take a look.

@sfc-gh-dszmolka
Copy link
Collaborator

thank you again for providing the details. The issue reproduces for me too. In my occassion, the process hangs for almost exactly 2 minutes. When attaching NODE_DEBUG=* to the runtime (and be overwhelmed by massive logs), loglines like

..
HTTP 57549: removeSocket myaccount.snowflakecomputing.com:443::::::::::::::::::::: writable: true
[2024-05-27T09:02:25.000Z] Successfully connected
TIMER 57549: process timer lists 90982
TIMER 57549: timeout callback 90000
TIMER 57549: 90000 list empty
TIMER 57549: process timer lists 121516
TIMER 57549: timeout callback 120000
TIMER 57549: 120000 list empty
2024-05-27 11:04:22

looks like that we might be unnecessarily waiting for axios default http timeout (90000) and browserActionTimeout (120000).

For me, the process hung always for ~120s; never for a minute or a longer than 2m period.

We're taking a look further into this behaviour.

However, you mentioned seeing axios related lines in the why-is-node-running - I did not see any entries for axios in it, in my reproduction. (I just run your app with calling node app.js). So if you can provide any more details on what exactly you saw, that might be relevant too. Thank you in advance !

@sfc-gh-dszmolka sfc-gh-dszmolka added status-triage_done Initial triage done, will be further handled by the driver team and removed status-triage Issue is under initial triage labels May 27, 2024
@nroa
Copy link

nroa commented Oct 24, 2024

Hello everyone!

We are hitting this error as well and wondering if using connection pool instead could work as a workaround?

@sfc-gh-dszmolka
Copy link
Collaborator

best would be to test it, but indeed could possibly help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests

4 participants