CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

Parallel execution error on version 1.2.1 - "Maximum call stack size exceeded"

Open jsparks19 opened this issue 8 years ago • 7 comments

What are you trying to achieve?

Run multiple tests in parallel

What do you get instead?

RangeError: Maximum call stack size exceeded at normalizeStringWin32 (path.js:33:30) at Object.resolve (path.js:338:20) at sync (C:...\npm\node_modules\codeceptjs\node_m odules\mkdirp\index.js:68:14) at sync (C:...\npm\node_modules\codeceptjs\node_m odules\mkdirp\index.js:77:24) at sync (C:...\npm\node_modules\codeceptjs\node_m odules\mkdirp\index.js:78:17) at sync (C:...\npm\node_modules\codeceptjs\node_m odules\mkdirp\index.js:78:17) at sync (C:...\npm\node_modules\codeceptjs\node_m odules\mkdirp\index.js:78:17) at sync (C:...\npm\node_modules\codeceptjs\node_m odules\mkdirp\index.js:78:17) at sync (C:...\npm\node_modules\codeceptjs\node_m odules\mkdirp\index.js:78:17) at sync (C:...\npm\node_modules\codeceptjs\node_m odules\mkdirp\index.js:78:17) path.js:33 function normalizeStringWin32(path, allowAboveRoot) {

Seems related to #1068

Details

  • CodeceptJS version: 1.2.1
  • NodeJS Version: 8.9.4
  • Operating System: Windows 7
  • WebDriverIO Version: 4.12.0
  • Configuration file:
{
  "output": "./output",
  "helpers": {
    "WebDriverIO": {
      "url": "url",
      "browser": "chrome",
      "host": "localhost",
      "port": "4444",
      "coloredLogs": true,
      "restart": false,
      "windowSize": "maximize",
      "keepCookies": true,
      "smartWait": 5000
    }
  },
  "multiple": {
    "blah": {
      "chunks": 2,
      "grep": "@blah"
    }
  },
  "include": {
    ...
  },
  "mocha": {},
  "bootstrap": false,
  "teardown": null,
  "hooks": [],
  "tests": "./tests/**/*/*_test.js",
  "timeout": 10000,
  "name": "codecept"
}

jsparks19 avatar Jun 14 '18 21:06 jsparks19

@jsoarks19 Have you tried adding "browsers": ["chrome"] to your blah config in multiple?

sveneisenschmidt avatar Jun 18 '18 05:06 sveneisenschmidt

@sveneisenschmidt I tried that just now and get the same error.

"multiple": {
    "blah": {
      "chunks": 2,
      "browsers": [ "chrome" ],
      "grep": "@blah"
    }
  }

jsparks19 avatar Jun 18 '18 13:06 jsparks19

This appears to be relate to issue #1084 I reported a few weeks back.

In either case the error seem to be throw in call to mkdirp. I added some logging to my local mkdirp index.js file as follows:

// starts at line 84
            default:
                var stat;
                try {
                    console.log(p); // added this
                    stat = xfs.statSync(p);
                    console.log(stat); // added this
                }
                catch (err1) {
                    console.log(err1); // added this
                    throw err0;
                }
                if (!stat.isDirectory()) throw err0;
                break;

What I found was that this code seems to be being called repeatedly until call stack size max is reached. Because of the way that mkdirp works, you might either get the call stack error or the false error of 'directory already exists` as reported in my issue, which gets thrown in the catch block when the call stack size error is triggered.

There is open issue in mkdirp library here - https://github.com/substack/node-mkdirp/issues/129 - so not sure that this is CodeceptJs issue at this point.

mikecbrant avatar Jun 19 '18 14:06 mikecbrant

I have identified root cause. The colon in the output directory (i.e. parallel:*) is not valid Windows character, causing the mkdirp call to always throw ENOENT which causes infinite recursion and the max call stack size error that is ultimately thrown. This is not mkdirp library error, but rather something that should be changed in this library to make sure invalid Windows path names are not being specified. I will put in PR to fix the issue.

mikecbrant avatar Jun 19 '18 15:06 mikecbrant

@mikecbrant @DavertMik Any idea when this fix will be released? Is there some sort of release schedule? Anxiously awaiting the fix for this one and #1069. :smile: Thanks so much!

jsparks19 avatar Jun 22 '18 03:06 jsparks19

This is working for me now after upgrading to 1.3.0. Thank you

jsparks19 avatar Jun 29 '18 19:06 jsparks19

Just a quick thing because I have read that other people had the same issue: I added a chrome extension to my WDIO test by adding it base64 encoded to capabilities.chromeOptions.extensions. Due to that, I saw the following error on each exit though: Maximum call stack size exceeded, even when the feature didn't have any errors. The solution was to remove the extension again from the capabilities before spawning, like so:

    before: (capabilities) => {
        // We have to remove the base64 encoded chrome browser extensions as
        // the object WDIO carries along otherwise takes up too much memory
        delete capabilities.chromeOptions.extensions
}

rickschubert avatar Oct 17 '18 14:10 rickschubert