linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] close.2: Mention a need of shutdown before closing socket
@ 2013-02-12 18:41 Peter Schiffer
  0 siblings, 0 replies; 11+ messages in thread
From: Peter Schiffer @ 2013-02-12 18:41 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-man-u79uwXL29TY76Z2rM5mHXA, Lukas Czerner

ping Michael

On Fri, 7 Oct 2011, Michael Kerrisk wrote:
 > Hi Lukas
 >
 > On Fri, Oct 7, 2011 at 9:09 AM, Lukas Czerner <lczerner@> wrote:
 >> On Fri, 7 Oct 2011, Michael Kerrisk wrote:
 >>
 >>> Lukas,
 >>>
 >>> On Mon, Aug 29, 2011 at 2:26 PM, Lukas Czerner <lczerner@...> wrote:
 >>>> When dealing with sockets, we have to be sure that there is no recv
 >>>> still blocking on it on another thread, otherwise it might block
 >>>> forever, since no more messages will be send via the socket. We
 >>>> should advice to use shutdown before closing socket.
 >>>
 >>> I'm looking into this now. The picture may be more complex than
 >>> this. Tell me, so you have a Solaris system available for testing?
 >>>
 >>> Thanks,
 >>
 >> Hi Michael,
 >>
 >> Thanks for looking into this. Unfortunately I do not have any
 >> Solaris system for testing, that was a customer report. His
 >> complaint was mainly not because the behaviour on Linux differs, but
 >> because this was not documented anywhere.
 >
 > Okay. I will see if I can find a test system somewhere. (The system I
 > used to use seems to have gone away.)
 >
 > Just FYI: I confirmed what you are seeing, but the issue seems more
 > general: basically, closing a file descriptor in one thread while
 > reading in another thread does not cause the read operation to
 > terminate (it will still read data if/when it becomes available).
 >
 > By the way, I'm wondering about creating a small repo of test
 > programs. I might like to add a modified version of your test program
 > to that repo. Can you put that code under a Free License and supply a
 > copyright?
 >
 > Thanks,
 >
 > Michael

Hi Michael,

no problem, here is the program, feel free to update it as you like.
Thanks for looking into this.

-Lukas
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCH] close.2: Mention a need of shutdown before closing socket
@ 2011-08-29 12:26 Lukas Czerner
       [not found] ` <1314620800-15587-1-git-send-email-lczerner-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Lukas Czerner @ 2011-08-29 12:26 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-man-u79uwXL29TY76Z2rM5mHXA, Lukas Czerner

When dealing with sockets, we have to be sure that there is no recv
still blocking on it on another thread, otherwise it might block forever,
since no more messages will be send via the socket. We should advice to
use shutdown before closing socket.

Signed-off-by: Lukas Czerner <lczerner-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 man2/close.2 |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/man2/close.2 b/man2/close.2
index a2a2961..02472f3 100644
--- a/man2/close.2
+++ b/man2/close.2
@@ -114,6 +114,13 @@ other threads in the same process.
 Since a file descriptor may be reused,
 there are some obscure race conditions
 that may cause unintended side effects.
+.PP
+When dealing with sockets, you have to be sure that there is no
+.BR recv (2)
+still blocking on it on another thread, otherwise it might block forever,
+since no more messages will be send via the socket. Be sure to use
+.BR shutdown (2)
+to shut down all parts the connection before closing the socket.
 .\" Date: Tue, 4 Sep 2007 13:57:35 +0200
 .\" From: Fredrik Noring <noring-zgYzP9v7iJcdnm+yROfE0A@public.gmane.org>
 .\" One such race involves signals and ERESTARTSYS. If a file descriptor
-- 
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-02-12 18:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-12 18:41 [PATCH] close.2: Mention a need of shutdown before closing socket Peter Schiffer
  -- strict thread matches above, loose matches on Subject: below --
2011-08-29 12:26 Lukas Czerner
     [not found] ` <1314620800-15587-1-git-send-email-lczerner-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-09-01  8:43   ` Lukas Czerner
     [not found]     ` <alpine.LFD.2.00.1109011043050.3665-D5fXUWdM4RC5eBp5B7zZTR/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2011-09-07 15:54       ` Lukas Czerner
2011-09-10 13:59   ` Michael Kerrisk
     [not found]     ` <CAKgNAkj_+h9njO6ffVg_1ckpBLdyHM=6iZyyU1jpL5sY6Zrs2Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-09-12 10:25       ` Lukas Czerner
     [not found]         ` <alpine.LFD.2.00.1109121215310.3888-D5fXUWdM4RC5eBp5B7zZTR/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2011-09-22  9:36           ` Lukas Czerner
2011-10-07  6:28   ` Michael Kerrisk
     [not found]     ` <CAKgNAkjDZufWp-H7NeSRT40FGBRCkMuisesbGcdJnD94OZucUA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-07  7:09       ` Lukas Czerner
     [not found]         ` <alpine.LFD.2.00.1110070906440.7183-D5fXUWdM4RC5eBp5B7zZTR/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2011-10-07 10:34           ` Michael Kerrisk
     [not found]             ` <CAKgNAki_fBFgoOHwsBbhocpzRt3_Zges49mLQwpkHfA+NYcxHA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-07 11:03               ` Lukas Czerner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).