-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Describe the bug
Currently, if incomingmessage errors due to intermittent network issues such as ECONNRESET, as the promise in the constructor in NodeResponse is unhandled, this bubbles up as unhandledRejection, crashing the process.
| reject(err); |
This is happening quite frequently, affecting our production environment.
To reproduce
This should be reproducible with a sample application that talks to the server but terminates the connection. I did not spend too much effort in getting a repro ready as the code fault and error location is clear.
Expected behavior
Rejection should not be unhandled and if request fails, LaunchDarkly SDK should serve the default value gracefully.
Logs
Note: promise has been monkey patched to get the stack trace of the promise init.
unhandledRejection
Error: aborted
at connResetException (node:internal/errors:720:14)
at TLSSocket.socketCloseListener (node:_http_client:461:19)
at TLSSocket.emit (node:events:529:35)
at TLSSocket.emit (node:domain:489:12)
at node:net:350:12
at TCP.done (node:_tls_wrap:657:7)
call site stack trace
at new MonkeyPromise (/var/service/out/lib/app.js:13:19)
at new NodeResponse (/var/service/node_modules/@launchdarkly/node-server-sdk/dist/src/platform/NodeResponse.js:12:24)
at ClientRequest.<anonymous> (/var/service/node_modules/@launchdarkly/node-server-sdk/dist/src/platform/NodeRequests.js:86:33)
at Object.onceWrapper (node:events:632:26)
at ClientRequest.emit (node:events:517:28)
at ClientRequest.emit (node:domain:489:12)
at HTTPParser.parserOnIncomingClient (node:_http_client:700:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
at TLSSocket.socketOnData (node:_http_client:541:22)
at TLSSocket.emit (node:events:517:28)
SDK version
@launchdarkly/node-server-sdk@8.2.4
Language version, developer tools
node v18
OS/platform
ubuntu:jammy@sha256:6042500cf4b44023ea1894effe7890666b0c5c7871ed83a97c36c76ae560bb9b