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
Transformation error when instrumenting the same file is multiple concurrent processes #141
Comments
I am having exactly the same issue with my own project: https://travis-ci.org/ehmicky/unix-permissions This is happening on Travis not AppVeyor, so this is not CI-specific. This also is only happening on Windows. I am also using The error messages are the same, including |
I've tried with |
Never mind, this is still happening: https://travis-ci.org/ehmicky/unix-permissions/jobs/523407051 |
This appears to be an upstream issue, possibly node.js itself. caching-transform uses write-file-atomic to save cache files, see npm/write-file-atomic#28. I'm open to suggestions but I don't know if this one can be solved. The only potential work-around would be to set |
Thanks for looking into it! |
When using
This error was also reported in npm/write-file-atomic#28, so this does seem to be the cause of this issue. |
This is odd as |
I implemented it wrong, and I also don't have that issue with most of my projects that use Using
Just trying to understand the problem here: did I get anything wrong? |
8 minutes vs 38 minutes... wow. That's quite a bit. I think this cancels my plan to set In theory you could create an npm pretest script that initializes the cache. This would be done by running const nycConfig = JSON.parse(process.env.NYC_CONFIG);
const testExclude = require('test-exclude')(nycConfig);
testExclude.globSync().forEach(source => {
require(source);
}); This should cause every file to be instrumented in a single process which runs before your tests. Note that the Also beware if any of your sources have side-effects during |
Actually it's more like: 22 minutes with Thanks for the workaround, I will try it out. I think the real fix for this issue is to have npm/write-file-atomic#28 fixed. That's a pretty complex one though. What about the following workaround: if - writeFileAtomic.sync(cachedPath, result, {encoding});
+ try {
+ writeFileAtomic.sync(cachedPath, result, {encoding});
+ } catch (error) {
+ if (error.code !== 'EPERM') {
+ throw error
+ }
+ } If caching fails, code should still work. The only difference is that instrumentation won't be cached for that file. Next time the file is instrumented, caching might succeed then. Some extra checks could be made be sure that Would this work? |
I'm not sure. In theory if we have this failure then the code should already be cached, unless we're getting a legit EPERM error. I'm thinking that it might be better to implement loop that will retry up to 3 times. If I'm against having caching-transform silently swallow errors. |
Yes you're right that seems like a more robust solution. |
@ehmicky I've been informed this write-file-atomic issue might be a regression in |
Thanks for checking this out! This version pinning does not resolve as expected. In
$ npm install
$ npm ls caching-transform
gulp-shared-tasks@0.27.57 /home/ehmicky/gulp-shared-tasks
├── caching-transform@3.0.2 (github:istanbuljs/caching-transform#c832db48c670a104a36d28aa3bf7ea7eb888395a)
└─┬ nyc@14.1.1
└── caching-transform@3.0.2 deduped (github:istanbuljs/caching-transform#c832db48c670a104a36d28aa3bf7ea7eb888395a) Somehow |
That is actually expected, caching-transform on |
Oh you're right. Unfortunately the bug is still happening even with
|
Thanks for testing. Please give it a try with |
Thanks, this seems to be working! I've tried re-running the CI jobs few times now, and there are no errors. I will try again through the weekend, and let you know if any errors is triggered. |
I have restarted the job about 15 times, and it seems to be working! |
This issue can be temporarily worked around by configuring your package.json with a development dependency on |
Thanks @coreyfarrell! |
The Windows CI of my project is failing intermittendly because of a transformation error (because of the output to
stderr
to be more precise).For example : https://ci.appveyor.com/project/ajafff/wotan/build/1.0.268
I use
nyc
to collect the coverage of myava
tests. The tests are run concurrently by default.This error seems to only occur when running the tests in parallel. And I don't have the same issue on Linux or macOS.
The issue occurred when I had no
cache: true
in my.nycrc.json
and after I enabled the cache.I guess this is related to concurrent access to the same cache.
What information do you need to diagnose this issue?
My project is https://github.com/fimbullinter/wotan
To run the tests with coverage, you need to
yarn install
andyarn compile
first and thennyc yarn test
The text was updated successfully, but these errors were encountered: