Ticket #6108 defect new
Opened 8 months ago
CannotListenError case of reactor.listenTCP leaks a socket for the garbage collector to clean up
| Reported by: | exarkun | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | core | Keywords: | |
| Cc: | Branch: | ||
| Author: | Launchpad Bug: |
Description
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
try:
skt = self.createInternetSocket()
if self.addressFamily == socket.AF_INET6:
addr = _resolveIPv6(self.interface, self.port)
else:
addr = (self.interface, self.port)
skt.bind(addr)
except socket.error as le:
raise CannotListenError(self.interface, self.port, le)
skt.listen(self.backlog)
Note: See
TracTickets for help on using
tickets.
