fix: Improve timeout handling during event loop lag#3418
Conversation
Make timeouts behave more closer that what is expected during event loop lag.
| if (this.timeoutDeadline && this.timeoutDeadline < Date.now()) { | ||
| onParserTimeout(this) | ||
| } |
There was a problem hiding this comment.
This will call Date.now() quite often... which is not optimal performance-wise. However, I don't see a smart way around it without using a worker as the point is to detect event loop lag before dispatching further events.
|
Have you got a reproduction of this? I'd like to tinker with this problem too. |
|
Nope. Had an 8 hour drive last night and was thinking about it. We've had a few possibly related issues here and there. |
|
Yes, I'm aware, I just don't know what's the best way to solve this. |
What are your thoughts on my proposal in this PR? |
|
I think we have 2 different problems:
i.e. basically two problems which an inverse of eachother. |
|
Just out of curiosity, even with this, it might still fall under the problem of high event loop lag, isn't it? Or I get it wrong? |
Not that I can think of? |
|
👋 Hi! Is there any way we can help/contribute to push this PR forward? We (Vercel) are getting more and more reports, which we believe are related to this specific issue. I'm personally not super familiar with Undici's codebase, but please let me know if there is any way we can help. |
|
Not high on my list. If you want more urgent help feel free to mail me. |
|
@ronag are we moving on this or do you need support on this front? |
|
I don't have time to work on it ATM. Feel free to take over. |
|
In the issue @Uzlopak said he's working on it. If you need support or something, let me know, I can work on it later this week |
Make timeouts behave more closer that what is expected during event loop lag.
This relates to...
Rationale
Changes
Features
Bug Fixes
Breaking Changes and Deprecations
Status