Opened 6 years ago

#6108 defect new

CannotListenError case of reactor.listenTCP leaks a socket for the garbage collector to clean up

Reported by: Jean-Paul Calderone Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:


The socket is created but not closed in the case of an exception:

    def startListening(self):
        """Create and bind my socket, and begin listening on it.                                                                                                                                  
        This is called on unserialization, and must be called after creating a                                                                                                                    
        server to begin listening on the specified port.                                                                                                                                          
        if self._preexistingSocket is None:
            # Create a new socket and make it listen                                                                                                                                              
                skt = self.createInternetSocket()
                if self.addressFamily == socket.AF_INET6:
                    addr = _resolveIPv6(self.interface, self.port)
                    addr = (self.interface, self.port)
            except socket.error as le:
                raise CannotListenError(self.interface, self.port, le)

Change History (0)

Note: See TracTickets for help on using tickets.