Nodejs 应用程序在使用 SAP Cloud SDK 管道部署到 CF 时间歇性泄漏内存



我们使用mta来构建由多个微服务组成的应用程序。

早些时候,我们使用CF CLI将微服务部署到SAP Cloud Foundry,但最近切换到SAP Cloud SDK Pipeline,使用蓝绿模式进行部署。

其中一个微服务是基于Nodejs的。 如果我们使用 CF CLI 来部署 nodejs 微服务,它只需要分配 2 GB 内存。 应用程序部署没有任何问题。

但是,对于上述相同的应用程序,如果我们切换到SAP云SDK管道进行蓝绿部署,则2 GB并不总是足够的。 不是每次,而是间歇性地,由于内存不足问题,应用程序部署失败。 我们甚至尝试将分配的内存增加到 4 GB,但仍然因上述问题而间歇性失败。

我们不确定,但看起来上述内存泄漏是由于 SAP Cloud SDK Pipeline.
的蓝绿部署模式造成的,如果有人可以帮助我们解决内存泄漏问题,我们将不胜感激。 请在下面找到日志。

[STG/0] OUT npm ERR! code ELIFECYCLE
[STG/0] OUT npm ERR! errno 137
[STG/0] OUT npm ERR! testapp@0.0.0 build-prod: `ng build`
[STG/0] OUT npm ERR! Exit status 137
[STG/0] OUT npm ERR! 
[STG/0] OUT npm ERR! Failed at the testapp@0.0.0 build-prod script.
[STG/0] OUT npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[STG/0] OUT npm ERR! A complete log of this run can be found in:
[STG/0] OUT npm ERR!     /home/vcap/.npm/_logs/2020-05-15T20_04_25_756Z-debug.log
[STG/0] OUT npm ERR! code ELIFECYCLE
[STG/0] OUT npm ERR! errno 137
[STG/0] OUT npm ERR! testapp@0.0.0 ci-build: `npm run build-prod`
[STG/0] OUT npm ERR! Exit status 137
[STG/0] OUT npm ERR! 
[STG/0] OUT npm ERR! Failed at the testapp@0.0.0 ci-build script.
[STG/0] OUT npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[STG/0] OUT npm ERR! A complete log of this run can be found in:
[STG/0] OUT npm ERR!     /home/vcap/.npm/_logs/2020-05-15T20_04_25_772Z-debug.log
[STG/0] OUT npm ERR! code ELIFECYCLE
[STG/0] OUT npm ERR! errno 137
[STG/0] OUT npm ERR! testapp@0.0.0 postinstall: `npm run ci-build`
[STG/0] OUT npm ERR! Exit status 137
[STG/0] OUT npm ERR! 
[STG/0] OUT npm ERR! Failed at the testapp@0.0.0 postinstall script.
[STG/0] OUT npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[STG/0] OUT npm ERR! A complete log of this run can be found in:
[STG/0] OUT npm ERR!     /home/vcap/.npm/_logs/2020-05-15T20_04_25_807Z-debug.log
[STG/0] OUT        [31;1m**ERROR**[0m Unable to build dependencies: exit status 137
[STG/0] ERR Failed to compile droplet: Failed to run all supply scripts: exit status 14
[STG/0] OUT Exit status 223 (out of memory)

我建议首先不要将ci-build注册为安装后脚本。 这不应该是必需的。管道将在npm install后自动调用npm run ci-build。我认为使用您当前的配置,它甚至可以在构建阶段执行两次。

由于 cf 部署也执行npm install因此将触发ci-build,这不应该是必需的,因为它之前已经执行过。

最新更新