Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start pm2 without log streaming and strange kill ESRCH error #1422

Closed
zdychacek opened this issue Jul 8, 2015 · 4 comments
Closed

Start pm2 without log streaming and strange kill ESRCH error #1422

zdychacek opened this issue Jul 8, 2015 · 4 comments

Comments

@zdychacek
Copy link

Hi,

firstly, thanks for pm2.

I want to ask few questions.

  1. Is there a way to run pm2 with --no-daemon flag and without log streaming? I log into one file with --merge-logs flag so it is unnecessary for me to log to stdout concurrently.
  2. Is there a way to split log output from application and from pm2 into separated log files?
  3. I am encountering strange error while runnnig app. My application is running in docker container, and this container periodically dies because of this PM2 error:
14:18:04 PM2 -softReload- Old worker disconnected
14:18:04 PM2 Stopping app:user-fe-api id:_old_15
14:18:04 PM2 190 pid can not be killed { [Error: kill ESRCH] code: 'ESRCH', errno: 'ESRCH', syscall: 'kill' }

Is there any advice what to do with this error?

I am running on iojs-2.3.3 and pm2-0.14.3.

Thanks for your reply.

O.

jshkurti added a commit that referenced this issue Jul 8, 2015
@jshkurti
Copy link
Contributor

jshkurti commented Jul 8, 2015

Hello Ondřej,

  1. For now I guess you could use something like pm2 start ... > /dev/null. We will eventually come up with a --no-logs flag someday.
  2. https://github.com/pm2-hive/pm2-logrotate
  3. ESRCH error means the pid you tried to kill does not exist. I have no clue why this would happen. We never experienced this issue before. Does it happen all the time ? Can you give it a try with npm i -g Unitech/PM2#development ?

Cheers.

@zdychacek
Copy link
Author

Hi Joni,

thanks for your quick reply.

If I use redirect to /dev/null I will also lose log messages from pm2 (those prefixed withPM2). I need to log these messages coming from PM2 too. So redirect to /dev/null is not a solution for me :(

Actually, my second question is related to the following. I would like to have an option to separate log outputs coming from PM2 and from my application. I mean, one log file with all messages prefixed with PM2 (those coming from PM2) and second log file with application specific logs. Can I separate logs somehow in this way?

Ad 3) Unfortunately this error is appearing periodically all the time :( Before I've updated pm2 from version 0.14.1 to 0.14.3 I had a problem with the following error: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory. Today I've done update to v0.14.3 and new error started to appear: { [Error: kill ESRCH] code: 'ESRCH', errno: 'ESRCH', syscall: 'kill' }

I am attaching json configuration with which I run the app:

{
    "name": "admin-fe-api",
    "script": "dist/app.js",
    "node_args": [
        "--max_old_space_size=400",
        "--es_staging",
        "--harmony_proxies"
    ],
    "log_file": "/var/....",
    "instances": 15,
    "max_memory_restart" : "300M",
    "merge_logs": true,
    "exec_mode": "cluster_mode",
    "vizion": false
}

I can see from my log, that workers are restarted several times/minute, when the traffic is high.

Here is another death output:

17:09:32 PM2 [PM2][WORKER] Process 13 restarted because it uses 0 memory and has ONLINE status
17:09:32 PM2 Stopping app:user-fe-api id:13
17:09:32 PM2 App name:user-fe-api id:13 disconnected
17:09:32 PM2 170 pid can not be killed { [Error: kill ESRCH] code: 'ESRCH', errno: 'ESRCH', syscall: 'kill' }
Shutting down
Sending SIGTERM to process tree at pid 34202
Killing the following process trees:
[ 
-+- 34202 /bin/sh -c exit `docker wait mesos-1bf34b1d-54a6-4371-8a41-d584b9cae0ce` 
 \--- 34203 docker wait mesos-1bf34b1d-54a6-4371-8a41-d584b9cae0ce 
]
Command terminated with signal Terminated (pid: 34202)

I have absolutely no idea how to solve this problem and be able to run pm2 inside docker container without pm2 death immediately followed by docker container death.

Thank you very much for any help.

@Unitech
Copy link
Owner

Unitech commented Jul 22, 2015

Refixed 0.14.5

@Unitech
Copy link
Owner

Unitech commented Apr 1, 2016

closing in favor of #2061

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants