node.js - Heroku 上的 Node 应用程序段错误:std::bad_alloc 和退出代码 134

标签 node.js debugging heroku segmentation-fault

我很难理解这个 Heroku 堆栈跟踪。我的应用程序在本地和 Heroku 中都运行良好几年了。然而,我突然被 Heroku 的立即崩溃所困扰。这是堆栈跟踪:

2019-05-14T14:05:14.947049+00:00 heroku[web.1]: Starting process with command `yarn run server`
2019-05-14T14:05:17.599376+00:00 app[web.1]: yarn run v1.16.0
2019-05-14T14:05:17.680344+00:00 app[web.1]: $ babel-node src/server.js
2019-05-14T14:05:20.674637+00:00 app[web.1]: Find the server at: http://localhost:13606/
2019-05-14T14:05:20.992257+00:00 heroku[web.1]: State changed from starting to up
2019-05-14T14:05:21.044128+00:00 app[web.1]: /app/.heroku/node/bin/node[43]: ../src/node_http_parser_impl.h:219:int node::{anonymous}::Parser::on_header_field(const char*, size_t): Assertion `(num_fields_) < (kMaxHeaderFieldsCount)' failed.
2019-05-14T14:05:21.203166+00:00 heroku[web.1]: Process exited with status 134
2019-05-14T14:05:21.044912+00:00 app[web.1]:  1: 0x98c680 node::Abort() [/app/.heroku/node/bin/node]
2019-05-14T14:05:21.045428+00:00 app[web.1]:  2: 0x98c707  [/app/.heroku/node/bin/node]
2019-05-14T14:05:21.045942+00:00 app[web.1]:  3: 0x9a878f  [/app/.heroku/node/bin/node]
2019-05-14T14:05:21.046587+00:00 app[web.1]:  4: 0x1845a8a http_parser_execute [/app/.heroku/node/bin/node]
2019-05-14T14:05:21.047108+00:00 app[web.1]:  5: 0x9aaf73  [/app/.heroku/node/bin/node]
2019-05-14T14:05:21.047681+00:00 app[web.1]:  6: 0xb8ed76  [/app/.heroku/node/bin/node]
2019-05-14T14:05:21.048731+00:00 app[web.1]:  7: 0xb90c89 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/app/.heroku/node/bin/node]
2019-05-14T14:05:21.049358+00:00 app[web.1]:  8: 0x1a86142  [/app/.heroku/node/bin/node]
2019-05-14T14:05:21.096170+00:00 app[web.1]: Aborted
2019-05-14T14:05:21.117588+00:00 app[web.1]: error Command failed with exit code 134.
2019-05-14T14:05:21.117924+00:00 app[web.1]: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2019-05-14T14:05:21.226349+00:00 heroku[web.1]: State changed from up to crashed
2019-05-14T14:05:21.231860+00:00 heroku[web.1]: State changed from crashed to starting
2019-05-14T14:05:25.403108+00:00 heroku[web.1]: Starting process with command `yarn run server`
2019-05-14T14:05:28.317361+00:00 app[web.1]: yarn run v1.16.0
2019-05-14T14:05:28.378392+00:00 app[web.1]: $ babel-node src/server.js
2019-05-14T14:05:30.597889+00:00 app[web.1]: Find the server at: http://localhost:6669/
2019-05-14T14:05:30.903500+00:00 app[web.1]: terminate called after throwing an instance of 'std::bad_alloc'
2019-05-14T14:05:30.903510+00:00 app[web.1]:   what():  std::bad_alloc
2019-05-14T14:05:30.919424+00:00 app[web.1]: Aborted
2019-05-14T14:05:30.937524+00:00 app[web.1]: error Command failed with exit code 134.

其他注意事项:

  • Heroku 内存使用量完全在配额范围内。
  • 本地一切运行良好。
  • 我的 heroku 应用已链接到 github 存储库,我已将其恢复为崩溃前的提交,但无济于事。
  • node_modules/未跟踪。
  • 我已关注 these清除缓存的说明。

这是我的package.json:

{
  "name": "korah-app",
  "version": "0.0.1",
  "private": true,
  "engines": {
    "node": ">8.9.1"
  },
  "dependencies": {
    "await-sleep": "^0.0.1",
    "babel-cli": "6.14.0",
    "babel-core": "6.14.0",
    "body-parser": "^1.17.2",
    "body-parser-xml": "^1.1.0",
    "bottleneck": "^2.12.1",
    "cors": "^2.8.4",
    "dotenv": "^4.0.0",
    "express": "4.13.3",
    "express-xml-bodyparser": "^0.3.0",
    "firebase-admin": "^4.1.3",
    "fs": "0.0.2",
    "heroku-ssl-redirect": "^0.0.4",
    "lodash": "^4.17.4",
    "moment": "^2.17.1",
    "node-schedule": "^1.3.0",
    "path": "^0.12.7",
    "request": "^2.81.0",
    "request-promise": "^4.2.1",
    "sql.js": "0.3.2",
    "string-similarity": "^1.2.2",
    "vhost": "^3.0.2",
    "voucher-code-generator": "^1.1.1",
    "xml-to-json-promise": "^0.0.3",
    "xml2js": "^0.4.17"
  },
  "scripts": {
    "server": "babel-node src/server.js",
    "ghb": "babel-node start_client_GHB.js",
    "dbw": "babel-node start_client_DBW.js",
    "lint": "eslint ."
  },
  "devDependencies": {
    "concurrently": "3.1.0",
    "eslint": "3.15.0",
    "eslint-config-airbnb": "14.1.0",
    "eslint-plugin-import": "2.2.0",
    "eslint-plugin-jsx-a11y": "4.0.0",
    "eslint-plugin-react": "6.9.0"
  }
}

有人可以帮助我了解如何尝试调试它吗?

最佳答案

确保我的 package.json 使用与本地运行相同版本的 Node 和 npm,为我解决了这个谜团。

  "engines": {
    "node": "12.1.0",
    "npm": "6.9.0"
  },

关于node.js - Heroku 上的 Node 应用程序段错误:std::bad_alloc 和退出代码 134,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56132683/

相关文章:

ruby-on-rails - 如何撤消 bundle install --deployment?

javascript - Google Static Maps API 与 jade 的动态链接

visual-studio-2010 - 防止输出窗口中的第一次机会异常

visual-studio - 在 Visual Studio 中调试时访问异常中断筛选器的更好方法?

C++:奇怪的指针损坏错误

ruby - 如何将公共(public)链接存储在备份变量中(使用 pgbackup :url) on heroku using the heroku-api. rb 文件

python - 使用 NLTK 的 Heroku Django 应用程序 : How do I use the NLTK corpora in the app?

node.js - 如何在 Node 中使用国家标志并使用react

angularjs - 在全新的 ubuntu 安装中使用 NPM 安装 angular-cli 时出错

node.js - 如何使用 forEach() 发送 res.send() 数组