achingbrain / pm2-web

A web based monitor for PM2
539 stars 90 forks source link

PM2 Uncaught exception TypeError: Cannot call method 'decode' of undefined #26

Closed jmav closed 10 years ago

jmav commented 10 years ago

2014-08-24T20:34:32.655Z - info: Express server listening on 0.0.0.0:4700 2014-08-24T20:34:32.818Z - error: PM2 Uncaught exception TypeError: Cannot call method 'decode' of undefined at Parser.decode (/usr/lib/node_modules/pm2-web/node_modules/pm2-interface/node_modules/axon/lib/parser.js:176:16) at Parser.parseBody (/usr/lib/node_modules/pm2-web/node_modules/pm2-interface/node_modules/axon/lib/parser.js:153:31) at Parser.frameBody (/usr/lib/node_modules/pm2-web/node_modules/pm2-interface/node_modules/axon/lib/parser.js:106:25) at Parser.write (/usr/lib/node_modules/pm2-web/node_modules/pm2-interface/node_modules/axon/lib/parser.js:50:13) at Parser.frameHeader (/usr/lib/node_modules/pm2-web/node_modules/pm2-interface/node_modules/axon/lib/parser.js:81:30) at Parser.write (/usr/lib/node_modules/pm2-web/node_modules/pm2-interface/node_modules/axon/lib/parser.js:49:36) at Socket.emit (events.js:95:17) at Socket. (_streamreadable.js:764:14) at Socket.emit (events.js:92:17) at emitReadable (_stream_readable.js:426:10)

jmav commented 10 years ago

Error appear if using PM2 v0.10.0, v0.10.1, v0.10.2, v0.10.3 https://github.com/Unitech/PM2/blob/master/CHANGELOG.md#0100---pm2-hellfire-release.

Older release of PM2 v0.9.6 is working ok, without bugs.

achingbrain commented 10 years ago

Interesting, looks like the error originates in pm2-interface's axon dependency - I don't have a laptop in front of me this second but maybe there's a new version of pm2-interface that will fix it.

jmav commented 10 years ago

I'we just got answer from @Unitech : You have to update pm2-inteface to the latest version (1.1.0)

It exist in npm, but it's not documented in repo.

achingbrain commented 10 years ago

@Unitech - any idea when the code that makes up pm2-interface v1.1.0 will be pushed to the pm2-interface repository?

MountVacation commented 10 years ago

I tested it, it's already available use npm install pm2-interface@1.1.0

achingbrain commented 10 years ago

Without visibility on what has changed between 1.1.0 and 0.1.3 I don't want to push an update out in case there are other breaking changes. I've opened an issue on the pm2-interface repository, could you please add your voice there?

In the meantime I'd recommend sticking to v0.9.6. Are there any features in 0.10.x that mean you must upgrade?

Failing that you can always edit the package.json for pm2-web under /usr/local/lib/node_modules/pm2-web (or wherever) and do a npm install from there.

Unitech commented 10 years ago

I updated the code of pm2-interface, but the API/interface is the same than before.

It's critical for people to switch to the 0.10.X for stability and leaks reasons.

Why there is an automatic update at installation ?

Because the communication protocol has been upgraded. Now it uses axon 2.0 instead of axon 1.0 to prepare the RPC dialog via Unix Socket file instead of TCP to enable user management/restriction for the PM2 1.0.X version.

As it has been upgraded, the old in memory PM2 can't interact anymore with the new PM2 CLI because of this new protocol. So I had to fix this with all this preinstall / postinstall stuff.

Preinstall/Postinstall hooks: https://github.com/Unitech/PM2/blob/master/package.json#L74

Postinstall.sh: https://github.com/Unitech/PM2/blob/master/scripts/postinstall.sh

The upgrade procedure: https://github.com/Unitech/PM2/blob/master/scripts/kill.js

The pm2-interface code has been updated https://github.com/Unitech/pm2-interface The interface/API is the same: https://github.com/Unitech/pm2-interface/commit/ee6993bcf9497398a348f587e75fd1b4ea6cfb0a#diff-d41d8cd98f00b204e9800998ecf8427e

Hope everything is clear!