Hi all

We're using supervisor[1] to manage a number of thrift servers written
in Python, which use the TForkingServer class. We're unable to get
supervisor to kill the process properly, however. Supervisor can send
TERM, QUIT or KILL to a process but no matter which we use the process
doesn't actually end, which means when supervisor tries to restart a
service it always fails. We have to then kill the process manually
from the command-line.

We don't find this problem with any other Python process (we have a
number of daemons running), or any other program (we also run PHP and
Redis).

Here is the code we're using to start the server:

from thrift.transport import TSocket, TTransport
from thrift.protocol import TBinaryProtocol
from thrift.server import TServer

# ... some set-up

if __name__ == '__main__':
  transport = TSocket.TServerSocket(8001)
  tfactory = TTransport.TBufferedTransportFactory()
  pfactory = TBinaryProtocol.TBinaryProtocolFactory()
  server = TServer.TForkingServer(processor, transport, tfactory, pfactory)

  try:
    server.serve()
  except KeyboardInterrupt:
    pass
  except:
    raise

Is there anything specific we need to do to kill the process cleanly?

-- 
Phillip B Oldham
[email protected]
+44 (0) 7525 01 09 01

Reply via email to