Error: Script execution timed out after 30000ms

3.3k Views Asked by At

I am trying to do some load testing. I am using newman in nodejs. In my script I have async.parallel to execute several collections in parallel. Then repeat set of parallel excution every 5 sec. In each run I have the following options:

collection: require('./collection.json'),
environment: require('./environment.json'),
timeoutRequest : 0, // infinite timeout
delayRequest: 1000, // ms
iterationCount: 5

Tha main loop looks like:

async function sleep(ms) {
  return new Promise(done => setTimeout(() => done(), ms));
}

async function orchestrator() {

  for (let j = 0; j < cycles; j++)

  {
    async.parallel(runItems,
      function(err, results) {
        if (err) {
          throw err;
        }
      }
    );
    await sleep(5000);
  }

The last 3 lines of output are:

code: ‘ERR_SCRIPT_EXECUTION_TIMEOUT’
}
Process exited with code 1

I set cycles to 500. All goes well for 70+ cycles but then I get the error mentioned.

Have you a solution or some work around I can do?

1

There are 1 best solutions below

0
On

It's likely a bug in either how Newman applies default timeout values, or how they are documented.

This is how it is supposed to work (source):

In a nutshell, the timeout behaviour is as follows:

  1. timeout: This is the global timeout value, the time in milliseconds for the entire collection run to complete.
  2. timeoutRequest: Similar to the above, but this value is applied individually across all requests in the collection run.
  3. timeoutScript: Similar to the above, but this value is applied individually across all scripts in the collection run.

For any of the 3 config values above, specifying a value of 0 will result in the timeout being set to Infinity.

My findings so far:

  1. I encountered a Script execution timeout error when running Postman 5.2.2 CLI with default settings. Opened an issue here
  2. Based on this comment setting timeout values to 99999 may help.