Skip to content
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

onConnectTimeout bug #3752

Closed
zabranskiy opened this issue Oct 21, 2024 · 5 comments
Closed

onConnectTimeout bug #3752

zabranskiy opened this issue Oct 21, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@zabranskiy
Copy link

zabranskiy commented Oct 21, 2024

Bug Description

[error] uncaughtException TypeError: Cannot read properties of undefined (reading 'autoSelectFamilyAttemptedAddresses') at onConnectTimeout (/usr/lib/node_modules/.../node_modules/undici/lib/core/connect.js:224:28) at Immediate.<anonymous> (/usr/lib/node_modules/.../node_modules/undici/lib/core/connect.js:206:11) at process.processImmediate (node:internal/timers:491:21)

undici/lib/core/connect.js file has function onConnectTimeout:

function onConnectTimeout (socket, opts) {
  let message = 'Connect Timeout Error'
  if (Array.isArray(socket.autoSelectFamilyAttemptedAddresses)) { <-- bug in this line
  ...
}

socket is undefined when the garbage collector has already freed the WeakRef, which leads to TypeError.

Reproducible By

It happens rarely on our prod.

Expected Behavior

No error.

Environment

Debian 12
nodejs 22.9.0
undici 6.20.0

@zabranskiy zabranskiy added the bug Something isn't working label Oct 21, 2024
@KhafraDev
Copy link
Member

#3751

@murrayee
Copy link

murrayee commented Nov 3, 2024

+1
Is there a solution?

@murrayee
Copy link

murrayee commented Nov 3, 2024

or how do I catch it?

@KhafraDev
Copy link
Member

@murrayee do you have a reproducible sample of code?

@Uzlopak Uzlopak closed this as completed Nov 11, 2024
@SolT31
Copy link

SolT31 commented Nov 12, 2024

Faced the same issue. Created a MR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants
@zabranskiy @Uzlopak @SolT31 @murrayee @KhafraDev and others