From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Sreedhar Kodali
<srkodali-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Cc: "Hefty,
Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] rsocket: Return ECONNRESET when socket in recv is disconnected
Date: Fri, 10 Oct 2014 11:45:47 -0600 [thread overview]
Message-ID: <20141010174547.GA10189@obsidianresearch.com> (raw)
In-Reply-To: <ec59646f09a80e3e61ce428b8dd87ce0-FJGp5E75HVmZamtmwQBW5tBPR1lH4CV8@public.gmane.org>
On Fri, Oct 10, 2014 at 10:37:34AM +0530, Sreedhar Kodali wrote:
> So the current behavior of returning 0 is wrong as there was no
> orderly shutdown performed on the other end before a close() is
> issued
'Orderly shutdown' is any call of close() when there is no data in the
recv queue, or shutdown(SHUT_WR).
> http://stackoverflow.com/questions/5879560/how-can-i-cause-an-econnreset-in-recv-from-a-client
This accepted answer is not correct, close on its own does not
generate ECONNRESET.
This is trivally shown with strace and a bit of python:
server:
import socket
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind(("127.0.0.1",9090))
s.listen(1)
conn, addr = s.accept()
conn.recv(1024)
client:
import socket
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(("127.0.0.1",9090))
s.close()
Result:
[..]
accept(3, {sa_family=AF_INET, sin_port=htons(41284), sin_addr=inet_addr("127.0.0.1")}, [16]) = 4
recvfrom(4, "", 1024, 0, NULL, NULL) = 0
ECONNRESET signals a special condition that it seems rsockets cannot
detect, as it doesn't have the one sided close semantics of TCP.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-10-10 17:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-08 22:19 [PATCH] rsocket: Return ECONNRESET when socket in recv is disconnected sean.hefty-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1412806773-23776-1-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-10-08 23:28 ` Jason Gunthorpe
[not found] ` <20141008232827.GA16102-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-10-08 23:38 ` Hefty, Sean
2014-10-09 11:09 ` Sreedhar Kodali
[not found] ` <56553bcab94dc48bde61d36ae9eb5eaa-FJGp5E75HVmZamtmwQBW5tBPR1lH4CV8@public.gmane.org>
2014-10-09 16:44 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A8237399DE7AE7-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-10-10 5:07 ` Sreedhar Kodali
[not found] ` <ec59646f09a80e3e61ce428b8dd87ce0-FJGp5E75HVmZamtmwQBW5tBPR1lH4CV8@public.gmane.org>
2014-10-10 5:34 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A8237399DE9543-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-10-13 3:51 ` Sreedhar Kodali
2014-10-10 17:45 ` Jason Gunthorpe [this message]
[not found] ` <20141010174547.GA10189-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-10-13 3:55 ` Sreedhar Kodali
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141010174547.GA10189@obsidianresearch.com \
--to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
--cc=linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=srkodali-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox