diff --git a/CHANGELOG.md b/CHANGELOG.md index 39fd221d..6f197586 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog -## Unreleased +## 3.0.5 + +- fix: Limit retryDelay to avoid integer overflows in setTimeout (#441) ## 3.0.5 diff --git a/src/main/transports/electron-offline-net.ts b/src/main/transports/electron-offline-net.ts index b5a0abe8..f3da820a 100644 --- a/src/main/transports/electron-offline-net.ts +++ b/src/main/transports/electron-offline-net.ts @@ -9,6 +9,7 @@ import { ElectronNetTransport, HTTPError, SentryElectronRequest } from './electr import { PersistedRequestQueue } from './queue'; const START_DELAY = 5_000; +const MAX_DELAY = 2_000_000_000; /** Returns true is there's a chance we're online */ function maybeOnline(): boolean { @@ -73,6 +74,12 @@ export class ElectronOfflineNetTransport extends ElectronNetTransport { this._retryDelay *= 3; + // If the delay is bigger than 2^31 (max signed 32-bit int), setTimeout throws + // an error and falls back to 1 which can cause a huge number of requests. + if (this._retryDelay > MAX_DELAY) { + this._retryDelay = MAX_DELAY; + } + return { status: 'unknown' }; }