Messages in this thread | | | Subject | Re: BUG in TCP for multithreaded apps | Date | Thu, 9 Dec 1999 13:23:59 +0000 (GMT) | From | Alan Cox <> |
| |
> appears with multithreaded applications. If a thread is doing a select() on > a file descriptor which is a socket in LISTEN state, and another thread is > closing the file descriptor, then select() does not return (with EBADF set).
When you close a handle the final close only takes affect when everyone has stopped using the handle. That is after the select returns
> My guess is that in tcp_close() for the special case state == TCP_LISTEN, > there is no call to sk->state_change(sk) before it is marked as dead.
More likely it is that the poll() function for a listening socket does not wake on closed. In fact this appears to be the problem.
If you edit net/ipv4/tcp.c:tcp_close() and move the
sk->shutdown = SHUTDOWN_MSK
above the if (sk->state == LISTEN)
Then I think it will work. Let me know
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |