简体   繁体   English

在Forever上运行时,NodeJS脚本被SIGKILL杀死

[英]NodeJS Script killed by SIGKILL when running on Forever

I have a Node.JS application that does a MySQL DB access, a few HTTP requests , saves the response CSV to a file, reads that same file and writes to Cassandra. 我有一个Node.JS应用程序,它执行MySQL数据库访问,一些HTTP请求,将响应CSV保存到文件,读取相同的文件并写入Cassandra。 I am running it on Ubuntu 14.04 and I'm using Express, to expose a web API that does all the above tasks. 我在Ubuntu 14.04上运行它并且我正在使用Express来公开执行上述所有任务的Web API。

I have another application written in Node.JS which calls the API for 200 users. 我有另一个用Node.JS编写的应用程序,它为200个用户调用API。 Since it's Node.JS, the calls are Async. 由于它是Node.JS,因此调用是Async。

I run the Express app using : 我运行Express应用程序:

node index.js

When I run the other script, which hits the Express API, the script runs fine for 200 users with a response: 当我运行另一个命中Express API的脚本时,该脚本可以为200个用户运行,并且有响应:

{"status":200,"message":"Got the data and saved to the DB"}

When I run the same Express App using Forever: 当我使用Forever运行相同的Express App时:

forever start -w index.js

and then run the cron Script for 200 users, I get 然后运行200个用户的cron脚本,我明白了

err { [Error: socket hang up] code: 'ECONNRESET' }

and when I open the log file, this is what I found: 当我打开日志文件时,这就是我发现的:

error: restarting script because add changed error: Forever detected script was killed by signal: SIGKILL error: Script restart attempt #5

Now that the App runs fine while running in the foreground and is killed while running in the background, does it have to do something about how much resources is allocated to a daemon process? 既然App在前台运行时运行良好并且在后台运行时被杀死,那么它是否需要为守护进程分配多少资源呢?

Should I crank up my server? 我应该启动我的服务器吗? Or is there any way I can allocate more resources to the Express App? 或者有什么办法可以为Express App分配更多资源吗?

Seems that you have problem with changing files or file attributes via pulling new code. 似乎您通过提取新代码来更改文件或文件属性时遇到问题。

try to configure .foreverignore for hidden subdirectories, like described here 尝试为隐藏的子目录配置.foreverignore,如此处所述

https://github.com/foreverjs/forever/issues/235 https://github.com/foreverjs/forever/issues/235

If you can't ignore or stop updating that files you need to stop using forever for watching file updates 如果您无法忽略或停止更新该文件,则需要永久停止使用以查看文件更新

I can recommend http://supervisord.org/ for running nodejs app on the Linux machines 我可以推荐http://supervisord.org/在Linux机器上运行nodejs app

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM