thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rush Manbert <>
Subject Re: AW: Re: AW: Re: AW: Re: ECONNRESET errors
Date Fri, 08 May 2009 23:29:32 GMT

On May 8, 2009, at 3:39 PM, Patrick Schlangen wrote:

> Hi,
>> How did your test turn out?
> the code seems to run flawlessly with the modifications and did not  
> raise the error messages a single time.
> I think disabling the read <-> peek optimization and enabling the  
> __FreeBSD__ code parts on a Mac would be a good idea.
> Maybe we should forward this to the developers?

I have done some more testing. If I change TSocket line 347 to this:
       #if defined __FreeBSD__ || defined __MACH__

then the ECONNRESET is just treated as a close. If I just make this  
change, but don't change TBufferTransports.h, I see this message once  
in a while from the server:
Thrift: Fri May  8 16:13:41 2009 TSocket::read() recv() <Host:  Port:  
0>Connection reset by peer

but I never see the "cleint died" message.

The message that I do see is generated at line 343 in TSocket, and  
it's generated even if the ECONNRESET is just a close, not a reset.

If you agree with this, then I think the change would be ONLY to  
TSocket.cpp. Replace current lines 342 through 356 with this:

     #if defined __FreeBSD__ || defined __MACH__
     if (errno_copy == ECONNRESET) {
       /* shigin: freebsd doesn't follow POSIX semantic of recv and  
fails with
        * ECONNRESET if peer performed shutdown
       return 0;

     // Now it's not a try again case, but a real probblez
     GlobalOutput.perror("TSocket::read() recv() " + getSocketInfo(),  

     // If we disconnect with no linger time
     if (errno_copy == ECONNRESET) {
       throw TTransportException(TTransportException::NOT_OPEN,  

It leaves in the check for ECONNRESET after the output, and we'll  
never get to it in OS X, but it makes the logic nice and clean.

What do you think?

- Rush

View raw message