Message25563
The SimpleXMLRPCServer constructor does not set
FD_CLOEXEC on the socket that listens for new
connections. When the XML RPC server spawns other
daemons, and the XML RPC server is stopped before
the spawned daemon dies, the spawned daemon will
hog the inherited socket and the XML RPC server will be
unable to open its listening socket again
(ADDR_IN_USE). Since there is no reason why a
spawned process should inherit the listen socket, the
close-on-exec flag should be used to prevent inheriting
the socket to spawned processes.
import socket
+ import fcntl
import xmlrpclib
...
def __init__(self, addr, ...
SocketServer.TCPServer.__init__(self, addr,
requestHandler)
! # close on exec - spawned shell should not
access the service
! # listen socket
! flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)
! flags |= fcntl.FD_CLOEXEC
! fcntl.fcntl(self.fileno(), fcntl.F_SETFD, flags)
!
There is a similar fix in the Zope distribution, see
http://archives.free.net.ph/message/20030719.201708.f3a
aed4d.html
|
|
Date |
User |
Action |
Args |
2007-08-23 14:32:30 | admin | link | issue1222790 messages |
2007-08-23 14:32:30 | admin | create | |
|