-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Bug?]: Performance impact of process.report.getReport()
is undesirable
#5167
Comments
Very interesting investigation. I'm marking it as an external bug since I don't see a lot we can do on Yarn's side - ideally Node should provide a simpler API. |
I also reported this on the Node side here: nodejs/node#46060 and for WSL here microsoft/WSL#9423 |
As @arty-name reported this bug is causing #4327 which is making |
Is there any workaround until the fix is provided? Since |
maybe this can help: nodejs/node#46060 (comment) |
@tadayosi You can work around the issue in WSL by disabling For other platforms, you'd still want to mitigate this issue at the DNS resolver level most likely. If there are other performance implications in There is also https://github.com/lovell/detect-libc/tree/main, but I'm not sure if that's an option. |
Can you try the 4.0.2 (literally just released)? It includes a workaround to avoid paying the |
Yes! Yarn is fast again! 😍 |
From my side, I feel like this issue has been resolved on the WSL distribution/platform level. The performance is as expected, even with the WSL-internal DNS resolver and even with pre-4.0.2. Thus, I'd like to close this issue. Non-WSL-related performance issues with That being said, nice to see that the report is no longer required 😊 |
Thanks. I tried 4.0.2 but unfortunately this doesn't solve my problem of |
You need to set
Though that will only really fix the issue when nodejs/node#55602 lands |
Self-service
Describe the bug
Yarn calls
process.report.getReport
internally to retrieve a list of loaded shared libraries to determine the C library in use. This can be seen following the code path atberry/packages/yarnpkg-core/sources/Project.ts
Lines 736 to 738 in 2615433
Yarn will grab this report and to generate the report, Node will go through all open handles in UV and retrieve information about them. Most importantly here, it will query information about all open socket handles. There handles are processed with https://github.com/nodejs/node/blob/9eb363a3e00dbba572756c7ed314273f17ea8e2e/src/node_report_utils.cc#L12.
As the above quoted comment implies, there is a larger issue on WSL. From my observations, WSL will, by default, register a very poor DNS resolver into the Linux distribution. This resolver is not only extremely slow, it also responds to all queries with an answer with a TTL of
0
. I expect that this causes the RDNS request for every single socket to go through the entire stack every single time.While this behavior is generally prevented in yarn by calling out to the report generator early, when using plugins like
upgrade-interactive
, a lot of sockets have been opened from the resolution process and this causes a very long hang when the report is being generated. This approach seems unreliable. Determination of platform specifics should not be hindered by DNS performance.To reproduce
Environment
Additional context
This problem is amplified by poor WSL default behavior, but the underlying issue should apply generally.
The text was updated successfully, but these errors were encountered: