You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Alexander Shigin (JIRA)" <ji...@apache.org> on 2008/07/25 16:51:31 UTC

[jira] Created: (THRIFT-96) TSocket.peek fails on FreeBSD

TSocket.peek fails on FreeBSD
-----------------------------

                 Key: THRIFT-96
                 URL: https://issues.apache.org/jira/browse/THRIFT-96
             Project: Thrift
          Issue Type: Bug
          Components: Library (C++)
            Reporter: Alexander Shigin


POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
{code}
  bool peek() {
    if (rBase_ == rBound_) {
      setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
    }
    return (rBound_ > rBase_);
  }
{code}

The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Commented: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "Kevin Clark (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12679238#action_12679238 ] 

Kevin Clark commented on THRIFT-96:
-----------------------------------

Last call. I'm going to push in the next few hours unless I get hear objections.

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>         Environment: FreeBSD
>            Reporter: Alexander Shigin
>         Attachments: thrift-freebsd-read.patch, thrift-peek-fix-2.patch, thrift-peek-fix.patch, thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Commented: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "Pavel Rebriy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12677126#action_12677126 ] 

Pavel Rebriy commented on THRIFT-96:
------------------------------------

What's the status of JIRA?

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>         Environment: FreeBSD
>            Reporter: Alexander Shigin
>         Attachments: thrift-freebsd-read.patch, thrift-peek-fix.patch, thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Updated: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "Alexander Shigin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Shigin updated THRIFT-96:
-----------------------------------

    Environment: FreeBSD

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>         Environment: FreeBSD
>            Reporter: Alexander Shigin
>         Attachments: thrift-freebsd-read.patch, thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Updated: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "Alexander Shigin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Shigin updated THRIFT-96:
-----------------------------------

    Attachment: thrift-peek-fix-2.patch

oops, forget to choose the right radio button

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>         Environment: FreeBSD
>            Reporter: Alexander Shigin
>         Attachments: thrift-freebsd-read.patch, thrift-peek-fix-2.patch, thrift-peek-fix.patch, thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Updated: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "Alexander Shigin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Shigin updated THRIFT-96:
-----------------------------------

    Attachment: thrift-peek-fix-2.patch

Sorry for a long time before response. I've changed the patch according to the last David comment.

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>         Environment: FreeBSD
>            Reporter: Alexander Shigin
>         Attachments: thrift-freebsd-read.patch, thrift-peek-fix-2.patch, thrift-peek-fix.patch, thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Updated: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "Alexander Shigin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Shigin updated THRIFT-96:
-----------------------------------

    Attachment: thrift-peek-fix.patch

The new version of patch checks ECONNRESET only if FreeBSD is target platform.

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>         Environment: FreeBSD
>            Reporter: Alexander Shigin
>         Attachments: thrift-freebsd-read.patch, thrift-peek-fix.patch, thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Commented: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "David Reiss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12616989#action_12616989 ] 

David Reiss commented on THRIFT-96:
-----------------------------------

mcslee, can you give us some insight into why the current version of TBufferedTransport::peek does a read instead of calling the underlying peek?

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>            Reporter: Alexander Shigin
>         Attachments: thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Commented: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "David Reiss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12616999#action_12616999 ] 

David Reiss commented on THRIFT-96:
-----------------------------------

Alexander, what would you think about doing the following instead?  Make TSocket::read return 0 even when recv returns ECONNRESET.  This would basically be forcing TSocket to use the POSIX semantics even on FreeBSD.

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>            Reporter: Alexander Shigin
>         Attachments: thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Commented: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "Jérémie BORDIER (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660846#action_12660846 ] 

Jérémie BORDIER commented on THRIFT-96:
---------------------------------------

What's this issue status ? I agree with David's last comment, leaving the current version of peek in TUnderlying sounds good without changing the current behavior of TBufferedTransport. Reviewed the patch, looks good to me.

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>         Environment: FreeBSD
>            Reporter: Alexander Shigin
>         Attachments: thrift-freebsd-read.patch, thrift-peek-fix.patch, thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Commented: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "David Reiss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637648#action_12637648 ] 

David Reiss commented on THRIFT-96:
-----------------------------------

I think the TSocket change is solid.  The TUnderlyingTransport change is mostly good, but it does change two behaviors.

1/ TBufferedTransport now uses the underlying peek instead of trying to read.  mcslee, can you give us some insight into why the current version of TBufferedTransport::peek does a read instead of calling the underlying peek?

2/ The read buffer for TFramedTransport is allocated unnecessarily at construction time.  This is not optimal, but I guess it is not a big deal since we reuse it if it is big enough.

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>         Environment: FreeBSD
>            Reporter: Alexander Shigin
>         Attachments: thrift-freebsd-read.patch, thrift-peek-fix.patch, thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Commented: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "Alexander Shigin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12617052#action_12617052 ] 

Alexander Shigin commented on THRIFT-96:
----------------------------------------

You are right, TSocket::read should follow the same semantic on a different  platform (I don't have an OpenSolaris but it seems recv acts like one on FreeBSD).

But I think the patch should be applied anyway: it reduces copy-paste in code.

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>            Reporter: Alexander Shigin
>         Attachments: thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Commented: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "Mark Slee (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637650#action_12637650 ] 

Mark Slee commented on THRIFT-96:
---------------------------------

I believe the reason for doing read() instead of peek() with TBufferedTransport was a mini-optimization. Since you're buffering the reads anyway, you might as well actually pull the data into your buffer if you're going to check for its existence. This way, you don't make a peek() call and a read() call, which is beneficial in the default case of using a buffered socket. This means 1 syscall to read() instead of 2 syscalls.

I'd be fine with switching this to use peek() on the underlying transport, since in some cases read() may have side effects that aren't wanted on the peek() operation (though I would expect this to be quite rare). But I'd also be fine with making the interface contract specify that calls to read() must not have any side effects that a peek() call would not also want.

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>         Environment: FreeBSD
>            Reporter: Alexander Shigin
>         Attachments: thrift-freebsd-read.patch, thrift-peek-fix.patch, thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Commented: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "David Reiss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637653#action_12637653 ] 

David Reiss commented on THRIFT-96:
-----------------------------------

peek is still virtual, right?  I think we should just keep the original version of peek defined in TBufferedTransport and leave the current version as the default in TUnderlying.  What do you guys think?

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>         Environment: FreeBSD
>            Reporter: Alexander Shigin
>         Attachments: thrift-freebsd-read.patch, thrift-peek-fix.patch, thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Updated: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "Alexander Shigin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Shigin updated THRIFT-96:
-----------------------------------

    Attachment: thrift-freebsd-read.patch

This patch makes TSocket::read to act on FreeBSD as on a normal platform.

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>            Reporter: Alexander Shigin
>         Attachments: thrift-freebsd-read.patch, thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Closed: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "Kevin Clark (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Clark closed THRIFT-96.
-----------------------------

    Resolution: Fixed
      Assignee: Alexander Shigin

Ok, pushed in 750585.

Sorry for the wait.

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>         Environment: FreeBSD
>            Reporter: Alexander Shigin
>            Assignee: Alexander Shigin
>         Attachments: thrift-freebsd-read.patch, thrift-peek-fix-2.patch, thrift-peek-fix.patch, thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Updated: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "Alexander Shigin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Shigin updated THRIFT-96:
-----------------------------------

    Attachment: thrift-peek-fix.patch

http://git.thrift-rpc.org/?p=thrift.git;a=shortlog;h=refs/heads/pri/shigin/peek

There is two changes:
  * create new TUnderlyingTransport to share common code with TBufferedTransport and TFramedTransport. The change need because TBufferedTransport doesn't call peek of underlying transport.
  * fix TSocket.peek for freebsd.

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>            Reporter: Alexander Shigin
>         Attachments: thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Updated: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "Alexander Shigin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Shigin updated THRIFT-96:
-----------------------------------

    Attachment:     (was: thrift-peek-fix-2.patch)

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>         Environment: FreeBSD
>            Reporter: Alexander Shigin
>         Attachments: thrift-freebsd-read.patch, thrift-peek-fix-2.patch, thrift-peek-fix.patch, thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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


[jira] Commented: (THRIFT-96) TSocket.peek fails on FreeBSD

Posted by "Kevin Clark (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12678834#action_12678834 ] 

Kevin Clark commented on THRIFT-96:
-----------------------------------

Are there any other issues with this ticket, or can I push?

> TSocket.peek fails on FreeBSD
> -----------------------------
>
>                 Key: THRIFT-96
>                 URL: https://issues.apache.org/jira/browse/THRIFT-96
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (C++)
>         Environment: FreeBSD
>            Reporter: Alexander Shigin
>         Attachments: thrift-freebsd-read.patch, thrift-peek-fix-2.patch, thrift-peek-fix.patch, thrift-peek-fix.patch
>
>
> POSIX says what recv(2) should returns 0 if peer has performed a shutdown. This feature uses in TBufferedTransport 
> {code}
>   bool peek() {
>     if (rBase_ == rBound_) {
>       setReadBuffer(rBuf_.get(), transport_->read(rBuf_.get(), rBufSize_));
>     }
>     return (rBound_ > rBase_);
>   }
> {code}
> The decision works fine on linux, but fails on freebsd. In freebsd, recv returns -1 and errno==ECONNRESET.

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