使用火炮通过超时检查端点时,v8中的致命错误

时间:2018-10-13 16:39:21

标签: node.js tcp

我正在测试Artillery,并且构建了一个应用程序,该应用程序在端点花费太长时间进行响应时测试其行为。为了模拟这一点,我创建了以下虚拟Express应用:

const express = require("express");
const app = express();
const PORT=3000;
const dateFormat = require("dateformat");

app.get("/timeout",(req,res) => {
    console.log("Processing...")
    var now = Date.now();
    setTimeout(() => {
        var next = Date.now();
        delta = next - now;
        res.send("Time:" + dateFormat(delta, "MM:ss"));
        console.log("Responded!");
    }, 10000);
});

app.listen(PORT, ()=> {
    console.log("Listening to the port", PORT);
})

process.on('uncaughtException', (err) => {
    console.log("========Uncaught exception========");
    console.log(err);
});

我让它在docker上运行。我运行的大炮脚本是这样的:

config:
  environments:
    node:
      target: 'http://localhost:3000/node'
      plugins:
        statsd:
          host: localhost
          port: 8125
          prefix: "artillery-node"

  pool: 50

  phases:
    - name: Plain
      duration: 120
      arrivalRate: 5
    - name: Ramp up
      duration: 825
      arrivalRate: 5
      rampTo: 60
    - name: Heavy
      duration: 30
      arrivalRate: 60


scenarios:
  - name: Timeout (/timeout)
    flow:
      - get:
          url: '/timeout'

现在,当我使用这种配置运行火炮时,最终节点将抛出此错误并退出:

FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
node::Abort() [node]
0x8c21ec [node]
v8::Utils::ReportApiFailure(char const*, char const*) [node]
node::TCPWrap::Instantiate(node::Environment*, node::AsyncWrap*, node::TCPWrap::SocketType) [node]
node::ConnectionWrap<node::TCPWrap, uv_tcp_s>::OnConnection(uv_stream_s*, int) [node]
0x141f590 [node]
0x1424d48 [node]
uv_run [node]
Run(Nan::FunctionCallbackInfo<v8::Value> const&) [/usr/app/node_modules/deasync/bin/linux-x64-node-8/deasync.node]
0x7f1d995811d7 [/usr/app/node_modules/deasync/bin/linux-x64-node-8/deasync.node]
v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [node]
0xad712c [node]
v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [node]
0x3daca6b842fd
Aborted
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! js@1.0.0 start: `node app.js`
npm ERR! Exit status 134
npm ERR! 
npm ERR! Failed at the js@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-10-13T16_20_51_567Z-debug.log

我研究了一些内容,可能是由于TCP关闭套接字而引发了异常。但是,如果发生这种情况,我该如何避免呢?

谢谢

0 个答案:

没有答案
相关问题