【问题标题】:Error: Script execution timed out after 30000ms错误:脚本执行在 30000 毫秒后超时
【发布时间】:2021-03-09 08:37:21
【问题描述】:

我正在尝试做一些负载测试。我在 nodejs 中使用 newman。 在我的脚本中,我有 async.parallel 来并行执行多个集合。然后每 5 秒重复一组平行执行。在每次运行中,我都有以下选项:

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

主循环如下所示:

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);
  }

最后3行输出是:

code: ‘ERR_SCRIPT_EXECUTION_TIMEOUT’
}
Process exited with code 1

我将周期设置为 500。70 多个周期一切顺利,但随后出现上述错误。

您有解决方案或我可以做的一些工作吗?

【问题讨论】:

    标签: javascript postman postman-collection-runner newman


    【解决方案1】:

    这可能是 Newman 如何应用默认超时值或记录它们的方式中的一个错误。

    这就是它应该如何工作的 (source):

    简而言之,超时行为如下:

    1. timeout:这是全局超时值,整个收集运行完成的时间(以毫秒为单位)。
    2. timeoutRequest:与上述类似,但此值单独应用于集合运行中的所有请求。
    3. timeoutScript:与上述类似,但此值单独应用于集合运行中的所有脚本。

    对于上述 3 个配置值中的任何一个,指定值 0 将导致超时设置为无限。

    到目前为止我的发现:

    1. 在使用默认设置运行 Postman 5.2.2 CLI 时遇到Script execution timeout 错误。打开一个问题here
    2. 基于this comment 将超时值设置为99999 可能会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-18
      • 1970-01-01
      • 2016-04-26
      • 2020-02-22
      • 2020-04-02
      • 1970-01-01
      相关资源
      最近更新 更多