Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Ticket #532 (defect)

Opened 2 years ago

Last modified 2 years ago

Allow reuse of listener socket on UNIX

Status: new

Reported by: fumanchu Assigned to: fumanchu
Priority: normal Milestone:
Component: wsgiserver Keywords:
Cc:

Thought up by Joseph Tate and discussed here and here:

UNIX allows the re-use of sockets via socket.fromfd(fd). _cpwsgiserver could pass the fd from one process to another via os.environ. UNIX users could then employ signal handlers like these:

def sigusr1(signum, frame):
    """Re-exec the process."""
    cherrypy.server.stop()
    cherrypy.log("Re-executing %s %s" % (sys.executable, sys.argv))
    os.execv(sys.executable, [sys.executable] + sys.argv)

def sigusr2(signum, frame):
    """Restart the HTTP server."""
    cherrypy.server.restart()

signal.signal(signal.SIGUSR1, sigusr1)
signal.signal(signal.SIGUSR2, sigusr2)

See [1116] for an experimental implementation of the socket reuse. The signal handlers could either be stuck in /lib somewhere, or enabled by default on platforms where hasattr(signal, "SIGUSR1").

Change History

06/03/06 15:00:00: Modified by fumanchu

10/13/06 13:22:02: Modified by lawouach

  • milestone deleted.

Not a showstopper for CP3.0. Let's get it out of the roadmap for now.

It will be interesting to have a solution in the next release however.

Hosted by WebFaction

Log in as guest/cpguest to create tickets