durusmail: quixote-users: Re: Need help in running quixote.demo as medusas' or twisteds' win32 service
Need help in running quixote.demo as medusas' or twisteds' win32 service
2004-03-29
Need help in running quixote.demo as medusas' ortwisteds' win32 service
2004-03-29
Need help in running quixote.demo as medusas' ortwisteds' win32 service
2004-03-29
Re: Need help in running quixote.demo as medusas' or twisteds' win32 service
2004-03-29
Re: Need help in running quixote.demo as medusas' or twisteds' win32 service
2004-03-29
Re: Need help in running quixote.demo as medusas' or twisteds' win32 service
2004-03-29
2004-03-29
Re: Need help in running quixote.demo as medusas' or twisteds' win32 service
Graham Fawcett
2004-03-29
Samir Patel wrote:
> I have created a quixote program which I like to run as service on
> windows machine using either medusa or twisted matrix as web server.
> I am having trouble with both of them. Am I missing something or I have
> to run it with IIS or Apache?

Warning, I didn't read your stack traces too carefully; Jason's advice may be
more on target. I'll just share a bit from my experiences with Quixote and
Windows services.

Getting the win32 event loop to play nicely with another loop (like Medusa's
asyncore loop or Twisted's reactor loop) can be a pain, at least in my limited
experience. Fortunately, you can "fake it" by having a service that starts a
new process, and run Quixote or Twisted in the new process. When you stop the
service, it can kill the webserver process. I wrote a message to the list last
year that describes this:

http://mail.mems-exchange.org/pipermail/quixote-users/2003-July/001721.html

The service.py script I use is available from that URL.

There are drawbacks, though -- when the service stops, it brings your server
down hard, so it may leave logfiles unflushed, and could have other
implications for your app. I recall some discusion back in July about ways to
attempt a more graceful shutdown, possibly through semaphores or sending
messages through pipes between the processes. If you manage to write any such
graceful-shutdown code, I'd be happy to see it. ;-)

Regards,

-- Graham



reply