soyuka / pidusage

Cross-platform process cpu % and memory usage of a PID
MIT License
512 stars 55 forks source link

TypeError: Buffer.alloc is not a function #74

Closed FrancoisPala closed 6 years ago

FrancoisPala commented 6 years ago

What's going wrong?

When starting my Docker container that is using pm2, I get this error:

pm2 launched in no-daemon mode (you can add DEBUG="*" env variable to get more messages)
[2018-07-24T20:34:53.113Z] PM2 log: Launching in no daemon mode
[2018-07-24T20:34:53.221Z] PM2 log: [PM2] Starting /src/server/server.js in cluster_mode (1 instance)
[2018-07-24T20:34:53.225Z] PM2 log: Starting execution sequence in -cluster mode- for app name:server id:0
[2018-07-24T20:34:53.286Z] PM2 log: App name:server id:0 online
[2018-07-24T20:34:53.289Z] PM2 log: [PM2] Done.
/usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:27
    buf = Buffer.alloc(SIZE)
                 ^

TypeError: Buffer.alloc is not a function
    at readUntilEnd (/usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:27:18)
    at /usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:68:5
    at FSReqWrap.oncomplete (fs.js:145:20)
pm2 launched in no-daemon mode (you can add DEBUG="*" env variable to get more messages)
[2018-07-24T20:35:01.420Z] PM2 log: Launching in no daemon mode
[2018-07-24T20:35:01.476Z] PM2 log: [PM2] Starting /src/server/server.js in cluster_mode (1 instance)
[2018-07-24T20:35:01.479Z] PM2 log: Starting execution sequence in -cluster mode- for app name:server id:0
[2018-07-24T20:35:01.539Z] PM2 log: App name:server id:0 online
[2018-07-24T20:35:01.541Z] PM2 log: [PM2] Done.
/usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:27
    buf = Buffer.alloc(SIZE)
                 ^

TypeError: Buffer.alloc is not a function
    at readUntilEnd (/usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:27:18)
    at /usr/lib/node_modules/pm2/node_modules/pidusage/lib/procfile.js:68:5
    at FSReqWrap.oncomplete (fs.js:145:20)

How could we reproduce this issue?

Start a Docker container that uses pm2

Supporting information

I'm using the latest node version to date (10.7.0), same for pm2 (3.0.1)

morfie78 commented 6 years ago

I have the same issue. 😟

soyuka commented 6 years ago

https://github.com/soyuka/pidusage/issues/72#issuecomment-407572581