Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Commit

Permalink
fix: race-condition that could leave stream in corked state (#78)
Browse files Browse the repository at this point in the history
If running Node.js 10.2.0 or newer, a race condition would occur in the
following scenarios that would leave the stream permanently corked:

- Call `flush` while the stream is corked and `bufferWindowTime !== -1`
- Call `sendSpan`, `sendTransaction`, `sendError`, or `sendMetricSet`
  while stream is corked, `bufferWindowTime === -1` and
  `_writableState.length >= bufferWindowSize`.
  • Loading branch information
watson committed Sep 2, 2019
1 parent 464d43e commit 913be08
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Expand Up @@ -310,7 +310,10 @@ Client.prototype._maybeUncork = function () {
if (this.destroyed === false) this.uncork()
})

if (this._corkTimer) clearTimeout(this._corkTimer)
if (this._corkTimer) {
clearTimeout(this._corkTimer)
this._corkTimer = null
}
}
}

Expand Down

0 comments on commit 913be08

Please sign in to comment.