TCP socket close question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have a multithreaded application where one thread is blocked in a call to 
send... the receiver's machine has crashed, or the network cable between the 
sender and receiver has been pulled.

I have a second thread on the sender that detects that the receiver has gone 
(basically a hearbeating scheme) and attempts to close the socket that the 
sender is sending on in order to wake up / unblock the sender.

What I see is that the second thread thinks it has closed the socket, but 
the first thread (blocked in a send on that socket) does not wake up and 
remains blocked.

Running this exact same code on Solaris 8, the blocked thread is woken up 
and returns with an error from send when the socket is closed by  the second 
thread.

If the second thread on the sender calls shutdown instead of close, the 
application is terminated with SIGPIPE. If I ignore or handle SIGPIPE and 
call shutdown, the blocked thread wakes up.

Any ideas as to why close does not wake up the blocked thread?

I am using the pthreads implementation that ships with Red Hat Linux 7.1 and 
a stock 2.4.2-2 kernel. I have sample code available that demonstrates this 
if anyone wants to look at it.

Regards,
Paul.


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux