-
Notifications
You must be signed in to change notification settings - Fork 259
CLDSRV-968: Expire idle keep-alive sockets in the functional test client #6247
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
base: development/9.3
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,18 @@ const DEFAULT_GLOBAL_OPTIONS = { | |
| // timeout. | ||
| const REQUEST_TIMEOUT = 30000; | ||
|
|
||
| // Idle timeout for pooled keep-alive sockets, which must stay below the | ||
| // server's own keep-alive timeout. Node's HTTP server closes idle keep-alive | ||
| // connections after 5s and advertises that as `Keep-Alive: timeout=5`, but the | ||
| // agent only acts on the hint when it already has a non-zero timeout of its own | ||
| // (`agentTimeout = this.options.timeout || 0`, and the hint can only lower an | ||
| // existing value). Without one, the agent keeps pooled sockets forever and | ||
| // eventually writes to connections the server has already closed, which | ||
| // surfaces as ECONNRESET ("socket hang up"). This only ever destroys sockets | ||
| // sitting in the free pool: an in-flight request is governed by | ||
| // REQUEST_TIMEOUT, which the SDK applies to the socket for its duration. | ||
| const AGENT_IDLE_TIMEOUT = 4000; | ||
|
|
||
| const DEFAULT_MEM_OPTIONS = { | ||
| endpoint: `${transport}://127.0.0.1:8000`, | ||
| port: 8000, | ||
|
|
@@ -43,6 +55,7 @@ const DEFAULT_MEM_OPTIONS = { | |
| maxSockets: 200, | ||
| keepAlive: true, | ||
| keepAliveMsecs: 1000, | ||
| timeout: AGENT_IDLE_TIMEOUT, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW, nodejs 22.20 has a new option
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh nice! Definitely worth a todo yeah. I'll create a ticket for nodejs upgrade add a todo in the comments to remove this config when tackling it. |
||
| }), | ||
| }), | ||
| }; | ||
|
|
@@ -57,6 +70,7 @@ const DEFAULT_AWS_OPTIONS = { | |
| maxSockets: 200, | ||
| keepAlive: true, | ||
| keepAliveMsecs: 1000, | ||
| timeout: AGENT_IDLE_TIMEOUT, | ||
| }), | ||
| }), | ||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment could be more succinct