Pm2: Error: ESPIPE: invalid seek, read

Created on 20 Jul 2019  路  11Comments  路  Source: Unitech/pm2

What's going wrong?

Following two errors repeatedly in the logs:

Error: ESPIPE: invalid seek, read
PM2 error: Error caught while calling pidusage

Stacktrace:
2019-07-20 14:27:23 default[20190720t070820] 2019-07-20T14:27:23: PM2 error: Error caught while calling pidusage
2019-07-20 14:27:23 default[20190720t070820] 2019-07-20T14:27:23: PM2 error: Error: ESPIPE: invalid seek, read
2019-07-20 14:27:23 default[20190720t070820] 2019-07-20T14:27:23: PM2 log: Stopping app:API id:0
2019-07-20 14:27:23 default[20190720t070820] 2019-07-20T14:27:23: PM2 log: App [API:0] exited with code [0] via signal [SIGINT]
2019-07-20 14:27:23 default[20190720t070820] 2019-07-20T14:27:23: PM2 log: pid=32 msg=process killed
2019-07-20 14:27:23 default[20190720t070820] 2019-07-20T14:27:23: PM2 log: PM2 successfully stopped

How could we reproduce this issue?

We followed steps from here: http://pm2.keymetrics.io/docs/usage/use-pm2-with-cloud-providers/
to run a NodeJS app on Google AppEngine.

Supporting information

$ pm2 report

Not able to run it on AppEngine/shell.

stale

Most helpful comment

I am also getting the same error in Google Cloud Run. @rup2701 did you manage to solve?

All 11 comments

I am also getting the same error in Google Cloud Run. @rup2701 did you manage to solve?

@italoiz i had the same problem with cloud run. After hours of trying out stuff, i just deleted the Cloud Run instance and redeployed it. This did the trick.

same problem with the cloud run. Locally working fine but when deployed, the log is flooded with the error.

Same, haven't tried deleting the service but I have redeployed/replaced the service.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I am getting the same issue on Google Cloud Run as well:

2020-06-17 15:14:01.536 CDT2020-06-17T20:14:01: PM2 error: Error caught while calling pidusage
2020-06-17 15:14:01.536 CDT2020-06-17T20:14:01: PM2 error: Error: ESPIPE: invalid seek, read

... repeating endlessly and filling up Stackdriver logs. Did anyone manage to fix this? I tried deleting and redeploying the service but it had no effect.

Have the same problem in docker

I have the same problem, but looks that anyone found a solution =/

@neil-119 have you found any solution for that? The same problem with pm2 on Cloud Run using pm2-runtime server.js but not finding any solution anywhere!

I am getting the same error also on Google Cloud Run

__I know this is not the best solution but it worked for me__, the thing is that pidusage package cannot read the memory and cpu percentage through the procfiles (which is the default method), I fixed by modifying the file on the pm2 project (See here) where its being called and added the param { usePs: true }

According to the documentation on https://www.npmjs.com/package/pidusage

By default, pidusage will use procfile parsing on most unix systems. If you want to use ps instead use the usePs option:

pidusage(pid, {usePs: true})

The solution is to run this command (in my case I added to my Dockerfile)), which is part of the process)

RUN sed -i 's/pidusage(pids, function retPidUsage(err, statistics) {/pidusage(pids, { usePs: true }, function retPidUsage(err, statistics) {/' {PATH WHERE YOU HAVE INSTALLED YOUR MODULES}/node_modules/pm2/lib/God/ActionMethods.js
Was this page helpful?
0 / 5 - 0 ratings