From thrift-user-return-477-apmail-incubator-thrift-user-archive=incubator.apache.org@incubator.apache.org Fri May 08 22:07:46 2009 Return-Path: Delivered-To: apmail-incubator-thrift-user-archive@minotaur.apache.org Received: (qmail 87886 invoked from network); 8 May 2009 22:07:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 May 2009 22:07:46 -0000 Received: (qmail 52236 invoked by uid 500); 8 May 2009 22:07:45 -0000 Delivered-To: apmail-incubator-thrift-user-archive@incubator.apache.org Received: (qmail 52208 invoked by uid 500); 8 May 2009 22:07:45 -0000 Mailing-List: contact thrift-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: thrift-user@incubator.apache.org Delivered-To: mailing list thrift-user@incubator.apache.org Received: (qmail 52198 invoked by uid 99); 8 May 2009 22:07:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 May 2009 22:07:45 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [192.160.13.69] (HELO mauve.rahul.net) (192.160.13.69) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 May 2009 22:07:35 +0000 Received: from mauve.rahul.net (orange.rahul.net [192.160.13.66]) by mauve.rahul.net (Postfix) with ESMTP id F236B2BD99 for ; Fri, 8 May 2009 15:07:14 -0700 (PDT) Received: from [192.168.0.240] (unknown [198.144.205.66]) by mauve.rahul.net (Postfix) with ESMTP for ; Fri, 8 May 2009 15:07:14 -0700 (PDT) Message-Id: <1C138B27-1330-43CD-A8D2-8E1FDD2D4A0D@manbert.com> From: Rush Manbert To: thrift-user@incubator.apache.org In-Reply-To: <493566D3-AB6D-4474-AAEB-D74E16CA1E56@manbert.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: AW: Re: AW: Re: ECONNRESET errors Date: Fri, 8 May 2009 15:07:14 -0700 References: <200607290533.k6T5XVk3021079@chatbox-smtp-out14.apple.com> <127002308764016919276418048404401220417-Webmail@me.com> <153283879375888780333830062973003381379-Webmail@me.com> <493566D3-AB6D-4474-AAEB-D74E16CA1E56@manbert.com> X-Mailer: Apple Mail (2.930.3) X-Filter: l=192.160.13.66 r=192.160.13.69 X-Virus-Checked: Checked by ClamAV on apache.org On May 8, 2009, at 2:48 PM, Rush Manbert wrote: > > On May 8, 2009, at 2:05 PM, Patrick Schlangen wrote: > >> Hi, >> >> the problem disappears if you define __FreeBSD__ in TSocket.cpp and >> change >> >> virtual bool peek() { >> /* shigin: see THRIFT-96 discussion */ >> if (rBase_ == rBound_) { >> setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), >> rBufSize_)); >> } >> return (rBound_ > rBase_); >> } >> >> to >> >> virtual bool peek() { >> return (rBound_ > rBase_ || transport_->peek()); >> } >> >> in TBufferTransports.h >> >> I don't know if this really fixes the issue or just hides it and I >> don't know if I break anything by making this change as I don't >> fully understand the code. >> >> I guess that MacOS's recv() implementation issues ECONNRESET the >> second time it is called on a closed socket. >> I'm going to test that. > > Hi Patrick, > > After your previous email I went and tested various flavors of > TSocket close(). I tried all the permutations of SHUT_RD, SHUT_WR, > SHUT_RDWR, and calling/not calling close on the client side. Nothing > makes the problem disappear. > > But you seem to have hit on the real issue. First, the code that > handles receiving ECONNRESET when the other side closes the socket > is qualified by a #define that isn't generated by configure when run > on the Mac. Second, the optimization in TBufferTransports.h looks > like it shouldn't be there, or should conditionally call the > underlying peek() on a Mac. I read through the THRIFT-96 discussion > and it sounds like calling the underlying peek is not a problem. Too > bad we hadn't come down this road before THRIFT-96 was accepted. In fact, if you change the line in TSocket from this: #if defined __FreeBSD__ to this: #if defined __FreeBSD__ || defined __MACH__ you get the desired behavior at that level. - Rush