[Dancer-users] many dancer apps with Starman (part 3)

Pedro Melo melo at simplicidade.org
Tue Jul 19 10:44:39 CEST 2011

On Mon, Jul 18, 2011 at 10:59 PM, Mr. Puneet Kishor <punk.kish at gmail.com> wrote:
> On Jul 18, 2011, at 4:56 PM, David Precious wrote:
>> On Monday 18 July 2011 22:43:25 Mr. Puneet Kishor wrote:
>>> The above is great help. However, I am trying to use `start_server` with
>>> `plackup` options and getting the following error
>>> $start_server --port=5000 --pid-file=pids/app.pid
>>> --status-file=status/app.status -- plackup -s Starman -w 10 -E production
>>> -D -a ~/Sites/blog/bin/app.pl start_server (pid:4453) starting now...
>>> starting new worker 4454
>>> new worker 4454 seems to have failed to start, exit status:0
>>> starting new worker 4461
>>> new worker 4461 seems to have failed to start, exit status:0
>>> starting new worker 4468
>>> new worker 4468 seems to have failed to start, exit status:0
>>> starting new worker 4475
>>> ^Cworker 4475 died unexpectedly with status:0, restarting
>>> starting new worker 4482
>>> received INT, sending TERM to all workers:4482
>>> worker 4482 died, status:0
>>> exitting
>>> and, in spite of the above, it seemed to have started several starman
>>> master processes. That is not what I wanted.
>>> $ps -ax | grep 'starman master'
>>> 4455 ??         0:00.01 starman master
>>> 4462 ??         0:00.01 starman master
>>> 4469 ??         0:00.01 starman master
>>> 4476 ??         0:00.01 starman master
>>> 4483 ??         0:00.01 starman master
>>> 4496 ttys001    0:00.00 grep starman master
>>> of course, the bare plackup command works fine
>>> $plackup -s Starman -w 10 -E production -D -a ~/Sites/blog/bin/app.pl
>>> The above starts only one master and 10 workers.
>>> Suggestions?
>> I suspect that start_server is expecting what it runs to stay around, whereas
>> plackup forks a new process then exits - and every time it does, start_server
>> tries to start another.
> Does that mean I can't use start_server as above?

David is right. You are using -D in the plackup invocation, and that
enables "daemon-mode" where plackup forks and goes to background.
start_server is compatible with daemon-mode. Just remove the -D from
your command and it should work just fine.

> I am curious -- how are others solving this problem. I seem to be one of the lonely Dancer users who has still not gotten the hang of starting several apps and managing them. While not directly a Dancer issue, surely this is a problem that Dancer servers would face, no?

I use straight plackup with Twiggy or Starman, it depends on my needs.
I don't use -D, and on the production environment, I run my apps
inside daemontools supervise.

This setup lacks graceful restarts, that's something that I'm working
on right now. Well, as soon as I end my fight with 3DSecure WSDL API
that is...

Pedro Melo
xmpp:melo at simplicidade.org
mailto:melo at simplicidade.org

More information about the Dancer-users mailing list