lkml.org 
[lkml]   [1999]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: BUG in TCP for multithreaded apps
Date
From
> 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/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.092 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site