[ 
https://issues.apache.org/jira/browse/THRIFT-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13904711#comment-13904711
 ] 

Hudson commented on THRIFT-2359:
--------------------------------

FAILURE: Integrated in Thrift #1047 (See 
[https://builds.apache.org/job/Thrift/1047/])
THRIFT-2359 TBufferedTransport doesn't clear it's buffer on a failed flush call 
(jensg: rev 8c1779d6712f102f2844621508e9f445540be7d2)
* lib/php/lib/Thrift/Transport/TBufferedTransport.php


> TBufferedTransport doesn't clear it's buffer on a failed flush call
> -------------------------------------------------------------------
>
>                 Key: THRIFT-2359
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2359
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.9.1
>            Reporter: Chris Trotman
>            Assignee: Jens Geyer
>              Labels: easyfix
>             Fix For: 0.9.2
>
>         Attachments: thrift-2359-fix-flush-in-tbufferedtransport-php.patch
>
>
> On flush in the php implementation of the TBufferedTransport it doesn't clear 
> the internal buffer before calling the underlying write function. However the 
> write function in TBufferedTransport does.
> {code:title=TBufferedTransport.php}
>   public function write($buf) {
>     $this->wBuf_ .= $buf;
>     if (TStringFuncFactory::create()->strlen($this->wBuf_) >= 
> $this->wBufSize_) {
>       $out = $this->wBuf_;
>       // Note that we clear the internal wBuf_ prior to the underlying write
>       // to ensure we're in a sane state (i.e. internal buffer cleaned)
>       // if the underlying write throws up an exception
>       $this->wBuf_ = '';
>       $this->transport_->write($out);
>     }
>   }
>   public function flush() {
>     if (TStringFuncFactory::create()->strlen($this->wBuf_) > 0) {
>       $this->transport_->write($this->wBuf_);
>       $this->wBuf_ = '';
>     }
>     $this->transport_->flush();
>   }
> {code}
> If a write on the underlying transport fails when we call flush, the internal 
> buffer won't be cleared.
> This causes some interesting issues when this happens. If you happen to call 
> the same function twice (first call fails to write, but the second one 
> succeeds), it will call the function on the server with the data provided in 
> the first call, rather than your current call.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to