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
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