On 5/22/07, Ian Bicking <[EMAIL PROTECTED]> wrote:
> > My other question is, paster has a --monitor-restart option to restart
> > the server if it dies.  But the Pylons Cookbook has recipes for
> > daemontools and supervisor2.   Are these better than paster's monitor
> > for some reason, or are they all interchangeable?
>
> They all work the same basic way.  paster's is simpler, obviously, since
> it's just one option.  But it hasn't been tested a whole lot, so I
> dunno.  Also it probably has more overhead than daemontools, though I
> don't know if it really is significant.

I looked through supervisor2 and am really impressed with its
features, but I couldn't get it to run my application and it wouldn't
say why not.  According to the docs, this happens frequently for a few
reasons that didn't seem to apply.  I wish it would take more care to
write a specific error message.

I suspect the problem was needing to set the PATH and PYTHONPATH to
match my workingenv.  I used the beta version of supervisor2 which
lets you set per-application environment variables.  But the app just
wouldn't start for no reason so I don't know if they were set.  I
tried launching "printenv" but it also quit silently -- and without
printing the environment to the log file.

Paster with --monitor-restart worked for two days but after I made a
little change in my application, it got into a curious snit where it
starts the application successfully but doesn't realize it has, so it
restarts itself again and again...  The console (Gentoo) says:

# /etc/init.d/inews2 start
 * Starting Incident News 2 server ...
Changing user to apache:apache (81:81)
Starting subprocess with monitor parent
Changing user to apache:apache (81:81)
Entering daemon mode
-------------------- Restarting --------------------
Changing user to apache:apache (81:81)
Entering daemon mode
-------------------- Restarting --------------------
Changing user to apache:apache (81:81)
Entering daemon mode
-------------------- Restarting --------------------
Changing user to apache:apache (81:81)
Entering daemon mode
-------------------- Restarting --------------------
Changing user to apache:apache (81:81)
Entering daemon mode
-------------------- Restarting --------------------

The application error log says:

Starting server in PID 27037.
Traceback (most recent call last):
  File "/mnt/data/www/apps/inews2/wenv-inews/bin/paster", line 13, in ?
    sys.exit(
  File "/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/PasteScript-1.3.3-py2
.4.egg/paste/script/command.py", line 76, in run
    invoke(command, command_name, options, args[1:])
[deleted lines]
"/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/PasteScript-1.3.3-py2
.4.egg/paste/script/serve.py", line 221, in command
    server(app)
  File "/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/PasteDeploy-1.3-py2.4
.egg/paste/deploy/loadwsgi.py", line 139, in server_wrapper
    wsgi_app, context.global_conf,
  File "/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/PasteDeploy-1.3-py2.4
.egg/paste/deploy/util/fixtypeerror.py", line 57, in fix_call
    val = callable(*args, **kw)
  File "/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/Paste-1.3-py2.4.egg/p
aste/httpserver.py", line 810, in server_runner
    serve(wsgi_app, *args, **kwargs)
  File "/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/Paste-1.3-py2.4.egg/p
aste/httpserver.py", line 782, in serve
    daemon_threads)
  File "/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/Paste-1.3-py2.4.egg/p
aste/httpserver.py", line 652, in __init__
    RequestHandlerClass, ssl_context)
  File "/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/Paste-1.3-py2.4.egg/p
aste/httpserver.py", line 633, in __init__
    RequestHandlerClass, ssl_context)
  File "/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/Paste-1.3-py2.4.egg/p
aste/httpserver.py", line 303, in __init__
    HTTPServer.__init__(self, server_address, RequestHandlerClass)
  File "/usr/lib/python2.4/SocketServer.py", line 330, in __init__
    self.server_bind()
  File "/usr/lib/python2.4/BaseHTTPServer.py", line 101, in server_bind
    SocketServer.TCPServer.server_bind(self)
  File "/usr/lib/python2.4/SocketServer.py", line 341, in server_bind
    self.socket.bind(self.server_address)
  File "<string>", line 1, in bind
socket.error: (98, 'Address already in use')
PID file /var/www/apps/inews2/data/paster.pid contains 27040, not
expected PID 27037
Starting server in PID 27040.
Traceback (most recent call last):
[deleted lines]
  File "/usr/lib/python2.4/SocketServer.py", line 341, in server_bind
    self.socket.bind(self.server_address)
  File "<string>", line 1, in bind
socket.error: (98, 'Address already in use')
Removing PID file /var/www/apps/inews2/data/paster.pid


I actually have better luck without --monitor-restart  It just starts and runs.

The executable production.ini with an [exe] section seems to work
pretty well.  I'm not sure if "paster serve --daemon production.ini"
or "start-stop-daemon ... paster serve production.ini" works; I
couldn't get it to.

-- 
Mike Orr <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to