-
-
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]: Yarn 3.2.0 hangs when diffing lockfiles due to endless-loop bug in diff
package
#4405
Comments
diff@4.0.1
diff
package
I've had this problem before. see #3764 |
Yes, this one is annoying - I think the best would be to switch to using Note that if we do this, another improvement I'd like to see would be to remove the diff printing if it's larger than, say, 200 lines (which is what I suspect |
I'm willing to try porting this fuctionality to I wanted to offer up a potentially different fix, which is to add an early-termination feature to jsdiff, as seen here: If @kpdecker agrees with this change -- and I imagine that the rationale that "yarn is broken" might get his attention! -- then we can minimize change and limit our execution time with a reasonable edit distance of ~100 lines, which is the most anyone ought to want to see on screen. If I can get in touch with him, I'll see about getting that fix merged - and might need to bump yarn's Thoughts on which approach is best for yarn? If we'd rather move toward eliminating a dependency, I'm happy to switch to |
Hat tip to @apenney for this find: As a short term fix, you can increase the So say you're running this in docker, you'd add to your Dockerfile something like |
Glad to add a maintainer to diff project if maintainers of yarn vouch for them. |
More specifically a collaborator on the yarn npm package vouches for that individual. I don't have the time to maintain the package, but want to be careful with who has publish access given how many machines this code ends up on. |
Understood. I'm a yarn neophyte, and so probably not vouchable-for, but perhaps one of the core collaborators will take you up on the offer. Regardless, I will contribute a yarn PR to use jsdiff 5 once the new build is published. |
Merged PR. Will have to dust off the build toolchain to get a release out. Will try to tackle this weekend. |
5.1.0 just published. |
diff
packagediff
package
* Upgrade diff to 5.0.0 * Add maxEditLength to lockfile patch. Fixes #4405. * Prepare fix for release * Upgrade diff to 5.1.0 * Re-resolve typescript 4.7.0-beta from npmjs.org * chore: versions Co-authored-by: Tony Spataro <anthony.spataro@appfolio.com> Co-authored-by: merceyz <merceyz@users.noreply.github.com>
* Upgrade diff to 5.0.0 * Add maxEditLength to lockfile patch. Fixes #4405. * Prepare fix for release * Upgrade diff to 5.1.0 * Re-resolve typescript 4.7.0-beta from npmjs.org * chore: versions Co-authored-by: Tony Spataro <anthony.spataro@appfolio.com> Co-authored-by: merceyz <merceyz@users.noreply.github.com>
Self-service
Describe the bug
When I
yarn install --immutable
inside a container as part of my CI process, Yarn detects that the lockfile would be updated and attempts to show me the diff before exiting with an error.For the particular lockfile that I am using with my project, the diff never completes: yarn runs forever, using 100% CPU, until I kill it.
To reproduce
I have isolated the problem to the
diff
package, a dependency of Yarn, and filed an issue with the maintainer of that package, including a self-contained reproduction that does not depend on yarn.Environment
Additional context
I am at an impasse: I can't upgrade my project to Yarn 2/3 as long as those tools are unstable and prone to disrupt my development workflow. It seems like Yarn's attempt to provide a UI nicety (colorized diffs) is making it fundamentally unstable.
The hang happens both with
diff@4.0.1
(used byyarn@3.2.0
) and the most recent build,diff@5.0.0
-- so a simple upgrade ofdiff
will not suffice to fix the issue.Short of fixing the underlying bug, I'm not sure how the Yarn team could proceed. Personally, I don't need the diff in the environments where this hang occurs -- or ever. A
.yarnrc.yml
flag to disable diffs would be an adequate workaround for me.I'm happy to attempt whatever feature the team decides is appropriate. Personally, I'm not sure I trust the
diff
package enough at this point to depend on it for a tool that is a core part of my software development lifecycle. I appreciate that yarn's goal is to run with no dependencies on the OS, however, and it seems that Yarn patches also usediff
-- so perhaps the Yarn team can provide some help to the maintainer ofdiff
.The text was updated successfully, but these errors were encountered: