-
-
Notifications
You must be signed in to change notification settings - Fork 651
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Description
Very occasionally, undici will throw this error as an uncaught rejection, causing the node process to crash.
The stack trace is as follows:
TypeError: Cannot read properties of null (reading 'destroyed')
at _resume (/node_modules/undici/lib/client.js:1429:16)
at resume (/node_modules/undici/lib/client.js:1334:3)
at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
Reproducible By
I am unable to replicate this issue consistently, but this issue pops up frequently, sometimes multiple times in a week.
Environment
Debian 12.4, node v18.19.0, undici 6.5.0
Additional context
if (!socket && !client[kHTTP2Session]) {
connect(client)
return
}
if (socket.destroyed || socket[kWriting] || socket[kReset] || socket[kBlocking]) {
return
}
The error occurs in the condition of the second if clause, where socket is null. I believe that
- client[kHTTP2Session] is not being set to null on socket close, despite socket being set to null. I see another function in client.js,
onUpgrade
, where socket is being set to null but client[kHTTP2Session] is not touched, but I believe this should not be called when client[kHTTP2Session] is truthy. - Perhaps first if clause should be rolled back to
if (!socket) {
to account for null socket even ifclient[kHTTP2Session]
is truthy, so that http2 connect logic is triggered if socket is null. I'm not entirely sure of the reason this if clause was changed.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working