Pm2: Start process breaks when params are too long

Created on 31 May 2016  路  4Comments  路  Source: Unitech/pm2

On pm2 1.1.3, if application's parameters defined after -- exceed a certain length, some kind of parsing error occurs and the start command fails with a script not found message.

This is my startup command:

NODE_ENV=production pm2 start -f app.js --name 'some-project' -- --logger.level=info --koa.hostname=0.0.0.0 --ms.amqp.hostname=amqps://localhost --ms.amqp.port=5673 --ms.amqp.heartbeat=30 --ms.amqp.username=someuser --ms.amqp.password=12345 --ms.amqp.vhost=default --mailer.config.host=localhost --mailer.config.auth=null

Executing that, ends up failing with:

[PM2][ERROR] script not found : /opt/local/some-project/--mailer.config.host=localhost
script not found : /opt/local/some-project/--mailer.config.host=localhost

However, if you _remove any of the flagged parameters_ above, the start will work as expected:

# Deleted mailer.config.host flag (picked at random, could have been any one parameter)
$ NODE_ENV=production pm2 start -f app.js --name 'some-project' -- --logger.level=info --koa.hostname=0.0.0.0 --ms.amqp.hostname=amqps://localhost --ms.amqp.port=5673 --ms.amqp.heartbeat=30 --ms.amqp.username=someuser --ms.amqp.password=12345 --ms.amqp.vhost=default --mailer.config.auth=null
[PM2] Starting app.js in fork_mode (1 instance)
[PM2] Done.

This is specially cumbersome for apps that have their configuration externalized and depend on env vars or custom flags for initialization.

Most helpful comment

As a workaround after issuing a pm2 save I have gone and edited the /home/{user}/.pm2/dump.pm2 manually and added the extra arguments.
After each entry, you'd be looking at a key called args.

Hope this get fixed though.

All 4 comments

The same problem here... I had 6 args and everything was fine. added another 2 and now it process doesn't get added. :tired_face:

As a workaround after issuing a pm2 save I have gone and edited the /home/{user}/.pm2/dump.pm2 manually and added the extra arguments.
After each entry, you'd be looking at a key called args.

Hope this get fixed though.

Seriously doubt anyone would pay us attention, seeing as they have 400+ issues opened by now.

closing in favor of #2272

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ldarren picture ldarren  路  3Comments

rangercyh picture rangercyh  路  4Comments

webchaz picture webchaz  路  3Comments

chaos-git picture chaos-git  路  3Comments

jubairsaidi picture jubairsaidi  路  3Comments