-
Notifications
You must be signed in to change notification settings - Fork 268
Non-accepted sockets and their parent sockets are never disassociated/freed #1781
Description
When a listening socket that has child sockets is closed, the listening socket will remain bound to the network interface until all child sockets have closed. If a listening socket has incoming connections which have not yet been accepted, and then that listening socket is closed, it is impossible to close those child sockets as the file handles for those non-accepted sockets have not yet been provided to the user space process*. The non-accepted child sockets will remain open forever, and so will the parent listening socket.
When a listening socket is closed, Shadow should close any pending (TCPCS_PENDING) child sockets, and when any incomplete (TCPCS_INCOMPLETE) child sockets become pending, they should be immediately closed. Once these pending and incomplete sockets are closed, the listening socket can be disassociated from the network interface and freed.
* Shadow currently registers child sockets in the descriptor table before the child socket has been accept()ed by the user space process; see #1780.