diff --git a/core/src/plugins/kubernetes/api.ts b/core/src/plugins/kubernetes/api.ts index fd2628e0cb..b9ba3097d8 100644 --- a/core/src/plugins/kubernetes/api.ts +++ b/core/src/plugins/kubernetes/api.ts @@ -57,7 +57,7 @@ import { PluginContext } from "../../plugin-context" import { PassThrough, Readable, Writable } from "stream" import { getExecExitCode } from "./status/pod" import { labelSelectorToString } from "./util" -import AsyncLock = require("async-lock") +import AsyncLock from "async-lock" import request = require("request-promise") import requestErrors = require("request-promise/errors") @@ -998,7 +998,7 @@ async function requestWithRetry( return await req() } catch (err) { if (shouldRetry(err)) { - retryLog = retryLog || log.debug("") + retryLog = retryLog || log.info("") if (usedRetries <= maxRetries) { const sleepMsec = minTimeoutMs + usedRetries * minTimeoutMs retryLog.setState(deline` @@ -1039,7 +1039,11 @@ function shouldRetry(err: any): boolean { code = err.statusCode } - return (code && statusCodesForRetry.includes(code)) || !!errorMessageRegexesForRetry.find((regex) => msg.match(regex)) + return ( + (code && statusCodesForRetry.includes(code)) || + err.code === "ECONNRESET" || // <- socket hang up + !!errorMessageRegexesForRetry.find((regex) => msg.match(regex)) + ) } const statusCodesForRetry: number[] = [ @@ -1061,6 +1065,8 @@ const errorMessageRegexesForRetry = [ /ETIMEDOUT/, /ENOTFOUND/, /EAI_AGAIN/, + /ECONNRESET/, + /socket hang up/, // This usually isn't retryable // However on github actions there seems to be flakiness // And connections get refused temporarily only