remap-istanbul icon indicating copy to clipboard operation
remap-istanbul copied to clipboard

Maximum call stack size exceeded

Open metrophos opened this issue 8 years ago • 7 comments

I get an stack size error when i use remap-istanbul on windows.

RangeError: Maximum call stack size exceeded at Object.fs.mkdirSync (fs.js:916:18) at sync (..\node_modules\mkdirp\index.js:71:13) at sync (..\node_modules\mkdirp\index.js:77:24) at sync (..\node_modules\mkdirp\index.js:78:17) at sync (..\node_modules\mkdirp\index.js:78:17) ...

I think remap-istanbul must parse to many files on my project.

To solve this issue I added a timeout function to give node.js the chance to clear the stack.

loadCoverage.js

        sources.forEach(function (filePath) {
            setTimeout(() => {
                collector.add(readJSON(filePath));
            });
        });

metrophos avatar Jul 28 '16 09:07 metrophos

same issue. The setTimeout trick worked.

g00fy- avatar Sep 05 '16 14:09 g00fy-

+1 on issue, workaround not tried.

vidartf avatar Sep 26 '16 13:09 vidartf

Unfortunately my workaround runs not all the time correct because now you have async setTimeout on an sync call. So the timeout calls are not completed before the object is returned.

I think the solution ist to change the logic from sync calls to async, return a promise and resolve them.

metrophos avatar Sep 27 '16 10:09 metrophos

Try only for test purpose node --stack_size=8192 node_modules/gulp/bin/gulp.js but this command depends on version of your nodejs

avocadee avatar Dec 15 '16 22:12 avocadee

Two pence:

For me I was having the same issue with infinite loops

but it was caused by nested folders with windows drives in it C:\

which seemed to be causing this bug -> https://github.com/substack/node-mkdirp/issues/66

e.g. for example path creation : "C:\development\GW-Maintenance\frontend-projects\web-platform\C:\development\GW-Maintenance\frontend-projects\web-platform\src\components\products\performance\ft-calendar-year-returns\lib\en-us-retail"

from node_modules\istanbul\lib\util\file-writer.js

Anthony-Mckale avatar Nov 14 '17 10:11 Anthony-Mckale

Looks like one solution might be to just go with a different library make-dir. Has anyone tried this?

jadrake75 avatar Oct 03 '18 05:10 jadrake75

i check the info that Anthony-Mckale provides. it seems if the driver of path does not exits, it will throw this error.

my case is that my container only have C:\ while I am trying to sync with D:. after change config to use C:\ as the driver of path, the problem fixed.

shaoxp avatar Nov 15 '19 02:11 shaoxp