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 1944643 network errors retry #1015

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
SNOW-1944643 - network error retries
sfc-gh-pmotacki committed Mar 4, 2025
commit 1838cdb0295b3cdddef0f41e701dd88641736ae9
4 changes: 1 addition & 3 deletions lib/connection/statement.js
Original file line number Diff line number Diff line change
@@ -1486,9 +1486,7 @@ function sendSfRequest(statementContext, options, appendQueryParamOnRetry) {
// if we haven't exceeded the maximum number of retries yet and the server
// came back with a retryable error code
if (numRetries < maxNumRetries &&
err && (Util.isRetryableHttpError(
err.response, false // no retry for HTTP 403
) || Util.isNetworkError(err))
err && (Util.isRetryableHttpError(err.response, false) || Util.isNetworkError(err))
) {
// increment the retry count
numRetries++;
2 changes: 1 addition & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
@@ -469,7 +469,7 @@ exports.isRetryableHttpError = function (response, retry403) {
};

exports.isNetworkError = function (err) {
return err.code === Errors.codes.ERR_SF_NETWORK_COULD_NOT_CONNECT
return err.code === Errors.codes.ERR_SF_NETWORK_COULD_NOT_CONNECT;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it mean only when we can't connect? Is it the customer problem or maybe it was more like resets?

};

exports.validateClientSessionKeepAliveHeartbeatFrequency = function (input, masterValidity) {
14 changes: 7 additions & 7 deletions test/authentication/connectionParameters.js
Original file line number Diff line number Diff line change
@@ -80,13 +80,13 @@ const keypairEncryptedPrivateKeyPath =

const wiremock =
{
...baseParameters,
accessUrl: null,
username: 'MOCK_USERNAME',
account: 'MOCK_ACCOUNT_NAME',
host: 'localhost',
protocol: 'http',
authenticator: 'OAUTH',
...baseParameters,
accessUrl: null,
username: 'MOCK_USERNAME',
account: 'MOCK_ACCOUNT_NAME',
host: 'localhost',
protocol: 'http',
authenticator: 'OAUTH',
};

exports.externalBrowser = externalBrowser;
7 changes: 0 additions & 7 deletions test/integration/testConnectionRetries.js
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@
* Copyright (c) 2015-2024 Snowflake Computing Inc. All rights reserved.
*/

const snowflake = require('./../../lib/snowflake');
const { v4: uuidv4 } = require('uuid');
const { runWireMockAsync, addWireMockMappingsFromFile } = require('../wiremockRunner');
const connParameters = require('../authentication/connectionParameters');
const AuthTest = require('../authentication/authTestsBaseClass');
@@ -16,11 +14,6 @@ describe('Connection test', function () {

this.timeout(180000);

snowflake.configure({
logLevel: "DEBUG",
disableOCSPChecks: true
});

before(async () => {
port = await testUtil.getFreePort();
wireMock = await runWireMockAsync(port);
2 changes: 1 addition & 1 deletion test/integration/testUtil.js
Original file line number Diff line number Diff line change
@@ -400,4 +400,4 @@ module.exports.getFreePort = async function () {
srv.close(() => res(port));
});
});
}
};
1 change: 0 additions & 1 deletion test/integration/wiremock/testWiremockRunner.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const assert = require('assert');
const fs = require('fs');
const net = require('net');
const axios = require('axios');
const { runWireMockAsync } = require('../../wiremockRunner');
const os = require('os');