You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "David Reiss (JIRA)" <ji...@apache.org> on 2009/06/04 02:12:07 UTC

[jira] Resolved: (THRIFT-497) TSocket read/peek fails on OS X

     [ https://issues.apache.org/jira/browse/THRIFT-497?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Reiss resolved THRIFT-497.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 0.2

> TSocket read/peek fails on OS X
> -------------------------------
>
>                 Key: THRIFT-497
>                 URL: https://issues.apache.org/jira/browse/THRIFT-497
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>    Affects Versions: 0.1
>         Environment: Mac OS X 10.5.6
>            Reporter: Rush Manbert
>             Fix For: 0.2
>
>         Attachments: 497-TSocket.cpp.patch
>
>
> Both TSocket::read() and TSocket::peek() have code that detects ECONNRESET in a FreeBSD environment and interprets it to mean that the socket was closed by the other side. This code was added by THRIFT-96.
> When Thrift is used under OS X, the server often sees the ECONNRESET error when the client has simply shutdown the socket. This makes sense since OS X is derived from FreeBSD.
> The attached patch modifies the read() and peek() routines to treat ECONNRESET as close() for OS X, just like it does for other FreeBSD versions. It also moves the read() error message display so that no error message is displayed when ECONNRESET is interpreted as close.
> Just past the error message, I left the test for ECONNRESET without making it depend on the __FREEBSD__ and __MACH__ macro definitions. This means that if a real error occurs on a FreeBSD-based system, there will be an extra check for ECONNRESET. I don't think this is a problem because you're on the way to throwing an exception anyway in that case, so the performance penalty of checking for ECONNRESET seems minimal. It also keeps the logic simpler.
> Patrick Schlangen gets credit for realizing that the __FREEBSD__ fix applied to OS X as well.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.