-
Notifications
You must be signed in to change notification settings - Fork 373
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
Fix underlying shared fs.read array #219
Fix underlying shared fs.read array #219
Conversation
Thanks for working on this @yawlhead91 :) |
@yawlhead91: The test succeeds even without your fix. Even if i'll add > 20 entries. Were you able to ensure that |
@bezoerb yes in my case I have tested it locally quite a bit with success. But you are right about the test, as i said In my other comment I will spend some time this weekend getting tests to you reproducing the issue. It is proven quite hard to reproduce the issue in mocha. My apologies about the other tests. 👍 |
@yawlhead91 any updates on this? |
I’m experiencing the same issue. I noticed that it always happens when (Node version 8.2.1, npm version 5.3.0.) |
Fixed in e9761a7 Switching from |
@matteodelabre: Thanks for the reproducing setup 🎉 |
About
Quick fix to the to a underline is issue where if you run critical in a loop, recursive function or through gulp can cause this error.
The reason for this is that when multiple calls to node
fs
methods in our casefs.readFileAsync
are made this can result inBuffers
that share a single underlyingArrayBuffer
. So basically if you look here .. https://github.com/addyosmani/critical/blob/master/lib/file-helper.js#L340we where trying to assign a array to the file.content which is why this error was appearing.
This is a vey small noice error, that probably rarely happens, but an issue is still is.
I added a small test that runs the critical in a loop twice this is not really sufficient as in my local case I was running critical over dozens of pages.
If you see here my production build I have run it on a few of my files which works perfect unlike before.
=========================================================
Ps. If you need any help on an issues I am more than happy to help