-
Notifications
You must be signed in to change notification settings - Fork 594
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
Excessive NodeError creation while using AbortSignal.timeout #4032
Comments
This was changed a month ago and is currently only available in node v22.13.0+ and v23.5.0+. If it could be backported to v20, we can consider removing it.
This looks like a bug in node. The condition should be changed to |
Correct. I just found that out right now, as I tried to reproduce the issue inside Fedora 41 which has 22.11. No issue there.
I agree. Seems like an honest mistake, since |
I submitted a PR to fix it, where I realized I added getEventListeners and therefore this bug. Whoops... |
PR-URL: #56807 Refs: nodejs/undici#4032 Refs: c1ccade Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chemi Atlow <[email protected]>
PR-URL: #56807 Refs: nodejs/undici#4032 Refs: c1ccade Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chemi Atlow <[email protected]>
Bug Description
I'm not sure if this is something that
undici
should handle or something that can be patched in node.We're using a timeout signal in every request made by fetch. Since the service is working as an API gateway, we do this A LOT.
It seems like this check is running unnecessary: AbortSignal has
[kMaxEventTargetListeners]
set to 0.So the
getMaxListeners
does not check considers theAbortSignal
to be anEventTarget
because the condition:evaluates to 0.
Should this not be surrounded by
try-catch
like is inundici
this would result in:Reproducible By
This should be as simple as running
Expected Behavior
Less time spent creating invisible, unimportant errors 🙂
Logs & Screenshots
The offending tree
![Image](https://private-user-images.githubusercontent.com/11974489/407340732-18c56db0-ac26-41de-9130-9b0d7a032959.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1MTM4MjMsIm5iZiI6MTczOTUxMzUyMywicGF0aCI6Ii8xMTk3NDQ4OS80MDczNDA3MzItMThjNTZkYjAtYWMyNi00MWRlLTkxMzAtOWIwZDdhMDMyOTU5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDA2MTIwM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTIwZTVkYmJmYmNkZWM5ZDY2ZDhlMzliZmEwMmU4NGExZmFmNDEzYTgzZDY4MzJkOWJjYzE1ODQ2NjYyZmQwZDMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.XT2mkganSznMYNEpAkXJEDmTQXPPnyb4Eoh6KuAGH6w)
getMaxListeners
![Image](https://private-user-images.githubusercontent.com/11974489/407340892-cbea008e-c7fc-44e0-806b-2dfa0305fe46.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1MTM4MjMsIm5iZiI6MTczOTUxMzUyMywicGF0aCI6Ii8xMTk3NDQ4OS80MDczNDA4OTItY2JlYTAwOGUtYzdmYy00NGUwLTgwNmItMmRmYTAzMDVmZTQ2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDA2MTIwM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTAxY2RlZDc3YTU0OGQ2ZGY5YjMxNGVlMDg0YTY0NmI1MWMzMjE4MjVmZTUxZmVmNjYzNWRhOGJhZTliZmE1MmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.bwcyLKu--9ODjg7lrGj7ov-9wCwCdaAWfqSFiQoZzw8)
Expensive NodeError
![Image](https://private-user-images.githubusercontent.com/11974489/407341060-866a744c-b728-4950-a224-ab760592348a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1MTM4MjMsIm5iZiI6MTczOTUxMzUyMywicGF0aCI6Ii8xMTk3NDQ4OS80MDczNDEwNjAtODY2YTc0NGMtYjcyOC00OTUwLWEyMjQtYWI3NjA1OTIzNDhhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDA2MTIwM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI1MDUxMzViZGM4YTdkZDY4NWU1OTI3Njg5YTYwYzA2NmFmOTQ0ZGM3YTNlOGEyNGRhNmU1YzdhMGFjZDExZWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.85TKM5xNoaYPIvkRYkGx4DLpfxm3eMnktc3D-y1hUVc)
Callsite
![Image](https://private-user-images.githubusercontent.com/11974489/407342475-7fd47f72-e2bb-43e0-94f5-c6f49e1bf3b4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1MTM4MjMsIm5iZiI6MTczOTUxMzUyMywicGF0aCI6Ii8xMTk3NDQ4OS80MDczNDI0NzUtN2ZkNDdmNzItZTJiYi00M2UwLTk0ZjUtYzZmNDllMWJmM2I0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDA2MTIwM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYwYTU5NzhlYjI2ZWYzNGJjYzBjMjMzODY0ODBjNDBkYWRkMWQ1ZjVkNjQ0NjcwZTg3YWJmNGQ5NGJjNDQxNmQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.aOYNTIwfJ_bUPPLEgn0O_pZUlJ9s6Atnbs58jaDYsCc)
Environment
Node v22.13.1 (running inside Alpine on Docker)
Using
undici
v7.Additional context
I see that there was this issue about the error being visible: nodejs/node#46823
Now it's just silent, but expensive.
The text was updated successfully, but these errors were encountered: