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

Use gunzip-maybe instead of reimplementing #2971

Conversation

victornoel
Copy link
Contributor

Summary

Following the PR to use tar-fs (#2826), I was looking at ways to solve #2629, and noticed that yarn had its own ad-hoc implementation of gunzipping the archives while there exists an available implementation already, by the same person who made tar-fs.

Even though it does not improve the situation for #2629 (of course), I thought it would make sense to use an existing library instead of an adhoc implementation.

Test plan

I ran yarn in a project with lots of dependencies, no node_modules and an empty cache.
I used the default network concurrency of 8.
Everything worked as expected.

@bestander
Copy link
Member

Looks like the right idea but there is a test error
TypeError: Cannot read property 'ended' of undefined
at Transform.Object..Writable.write (/home/ubuntu/yarn/node_modules/peek-stream/node_modules/readable-stream/lib/_stream_writable.js:191:12)
at Duplexify.Object..Duplexify._write (/home/ubuntu/yarn/node_modules/duplexify/index.js:201:22)
at doWrite (/home/ubuntu/yarn/node_modules/readable-stream/lib/_stream_writable.js:347:64)
at writeOrBuffer (/home/ubuntu/yarn/node_modules/readable-stream/lib/_stream_writable.js:336:5)
at Duplexify.Object..Writable.write (/home/ubuntu/yarn/node_modules/readable-stream/lib/_stream_writable.js:274:11)
at Gunzip.ondata (_stream_readable.js:555:20)
at emitOne (events.js:96:13)
at Gunzip.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at Gunzip.Readable.push (_stream_readable.js:134:10)
at Gunzip.Transform.push (_stream_transform.js:128:32)
FAIL tests/commands/install/integration.js

@victornoel
Copy link
Contributor Author

is there any way to see which test is failing? the test file is huge…

@bestander
Copy link
Member

bestander commented Mar 23, 2017 via email

@victornoel
Copy link
Contributor Author

@bestander it says which file it is (__tests__/commands/install/integration.js) but not which test it is in this file, and there is a bunch of tests there…

@bestander
Copy link
Member

You are right, it is not able to run the whole test suite because of the crash.
Can you reproduce this locally?
If yes then try running them one by one by replacing all test.concurrent with test, it will show on which test it is failing

@victornoel
Copy link
Contributor Author

Ok, so I never managed to have jest print the name of the failing test, but with a bit of help of dichotomy magic, I narrowed the problem to the third test changes the cache directory when bumping the cache version.

I will investigate

@victornoel
Copy link
Contributor Author

Ok, so, I'm not clear on the real reason why it doesn't work.

To me the problem is coming from readable-stream which is a transitive dependencies of gunzip-maybe (via peek-stream and through2) in a very old version.

If I force the version of readable-stream/through2 to be the latest, then things work without problem. I will open an issue for the right package (I think peek-stream) and until then let's put this PR on hold.

@bestander
Copy link
Member

Thanks for investigating, @victornoel.
Ping me when there is some resolution

@bestander
Copy link
Member

@victornoel, any luck?
Should we close the PR while it is not in a mergeable state or you want to give it another try soon?

@victornoel
Copy link
Contributor Author

@bestander I just took a look at it again. Basically the problem is that some dependencies of gunzip-maybe are too old and buggy (readable-stream precisely). I opened an issue for peek-stream (the one depending on an old version of through2 that bring the old readable-stream with it) but I got no answer from its maintainer (I pinged him again today).

So either there is any way to force the version of a dependency's dependency with yarn (except via editing the yarn.lock file by hand :), but I couldn't find one documented, or we simply need to wait. In the latter case, you can close this if you prefer, and I will reopen another PR when needed :) Thanks for your patience!

@victornoel victornoel force-pushed the gunzip-maybe-instead-of-adhoc-implementation branch from 704adc4 to 094d096 Compare April 8, 2017 10:37
@victornoel
Copy link
Contributor Author

@bestander don't close, I should be pushing soon a working PR :)

@victornoel victornoel force-pushed the gunzip-maybe-instead-of-adhoc-implementation branch from 094d096 to 2edef3e Compare April 8, 2017 12:27
@victornoel
Copy link
Contributor Author

not sure why it fails... seems there is some timeout issues

@victornoel
Copy link
Contributor Author

anyway, my PR is good as it is, the dependencies were updated in gunzip-maybe's dependencies and the test that was failing before does not fail anymore.

@victornoel victornoel force-pushed the gunzip-maybe-instead-of-adhoc-implementation branch from 2edef3e to b0a58af Compare April 15, 2017 08:16
@victornoel
Copy link
Contributor Author

@bestander I've rebased with latest master. The travis build passes, but the other two seems to timeout on one of the test (the same one "root install with optional deps", once with node 6, once with node 4). It runs fine on my machine (both with node 6 and 4), so I'm not sure what to do about that...

@bestander
Copy link
Member

bestander commented Apr 15, 2017 via email

@arcanis
Copy link
Member

arcanis commented Apr 18, 2017

Since the failing tests seem unrelated and there's already a few other PRs related to tar streams, I'll merge this one before it requires any more rebase :)

@arcanis arcanis merged commit 0897457 into yarnpkg:master Apr 18, 2017
@victornoel victornoel deleted the gunzip-maybe-instead-of-adhoc-implementation branch April 18, 2017 16:06
@victornoel
Copy link
Contributor Author

cool, thanks :)

This was referenced Apr 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants