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

Arya Goudarzi updated THRIFT-867:
---------------------------------

    Attachment: thrift-867.diff

Actually, after investigating this more, I figured the problem is not with 
buffered being flushed once for FramedTransport, but that FramedTransport cares 
to exactly read the number of bytes as dictated to it by the first 4 bytes of 
the stream, otherwise it behaves incorrectly to the point that your operation 
will no succeed. The problem was that  Accelerated Module, PHPOutputTransport 
class had a destructor calling out flush(). However the flush is called by the 
thrift_protocol_write_binary function inside the exception wrappers right where 
it needs to be after all the data is serialized into the stream, thus the extra 
flush inside destructor is not needed at all. This was not a problem for 
Buffered Transport because it reads everything it gets but this was causing 
problem for FramedTransport because it was causing an extra 0 (size of empty 
buffer after last flush) to be packed and placed at the end of stream making it 
confuse FramedTransport. So, attached please find the one liner patch to 
php_thrift_protocol.cpp. I tested this with Cassandra using FramedTransport up 
to 15Mb where I have it configured for max Frame size, and for variety of 
BufferTransport sizes. Feel free to do you own QA. 

> PHP accelerator module's output transport is incompatible with 
> TFramedTransport
> -------------------------------------------------------------------------------
>
>                 Key: THRIFT-867
>                 URL: https://issues.apache.org/jira/browse/THRIFT-867
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.4
>            Reporter: Bryan Duxbury
>             Fix For: 0.5
>
>         Attachments: thrift-867.diff
>
>
> I think we've figured out the cause of everyone's problems with THRIFT-837. 
> The patch itself is fine; however, in fixing that bug, we've exposed the fact 
> that PHPOutputTransport erroneously calls down to the underlying PHP 
> transport's flush() method every time the internal 8k buffer is flushed. This 
> is fine for the buffered transport, but unacceptable for the framed 
> transport, which should only be flushed once per RPC call.
> It seems like what we need to do is separate the "internal" buffer flushes 
> from the "external" transport flushes. If we do that, everything should work 
> out fine.

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

Reply via email to