You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Hudson (JIRA)" <ji...@apache.org> on 2011/06/30 21:20:28 UTC

[jira] [Commented] (THRIFT-1228) The php accelerator module calls flush incorrectly

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

Hudson commented on THRIFT-1228:
--------------------------------

Integrated in Thrift #182 (See [https://builds.apache.org/job/Thrift/182/])
    THRIFT-1228. php: The php accelerator module calls flush incorrectly

This patch makes sure that filling the php extension's internal buffer does not cause a premature flush of the whole transport.

Patch: Nathaniel Cook

bryanduxbury : http://svn.apache.org/viewvc/?view=rev&rev=1141668
Files : 
* /thrift/trunk/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp


> The php accelerator module calls flush incorrectly
> --------------------------------------------------
>
>                 Key: THRIFT-1228
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1228
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.7
>            Reporter: Nathaniel Cook
>            Assignee: Nathaniel Cook
>              Labels: php
>             Fix For: 0.7
>
>         Attachments: thrift-1228.patch
>
>
> The php accelerator module calls flush on the transport when its internal buffer is full. However it should only write its internal buffer to the transport and flush to the transport when flush is explicitly called.
> I ran into this problem because I am using thrift to send data from php to java using a THsHaServer in java which requires the use of a TFramedTransport. As a result of this incorrect behavior, partial messages where sent to the THsHaServer and it couldn't handle them.
> The php extension has an internal buffer of some size (8K by default). When this internal buffer fills up the extension would write its buffer to the transport and call flush on the transport. So messages that are greater than 8K would be broken up and sent it different frames to the THsHAServer causing errors.
> The correct behavior is for the php extension to just call write on its transport when its internal buffer is full and then to call flush once the message is complete. I have submitted a patch that fixes this bug. I created a new protected method on the PHPOutputTransport called internalFlush that just writes the internal buffer to the transport. This way flush is only called when a message is complete and the internal buffer can get flushed to the PHP transport object when it is full.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira