You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Marimuthu Ponnambalam (JIRA)" <ji...@apache.org> on 2011/07/20 07:44:57 UTC

[jira] [Created] (THRIFT-1240) TBinarySerializer.php invalid serialization due to TBufferTransport not flushing last chunk of data into TMemoryBuffer

TBinarySerializer.php invalid serialization due to TBufferTransport not flushing last chunk of data into TMemoryBuffer
----------------------------------------------------------------------------------------------------------------------

                 Key: THRIFT-1240
                 URL: https://issues.apache.org/jira/browse/THRIFT-1240
             Project: Thrift
          Issue Type: Bug
          Components: PHP - Library
    Affects Versions: 0.6.1
         Environment: Cent OS and Mac OS 10.5
            Reporter: Marimuthu Ponnambalam
            Priority: Critical
             Fix For: 0.6.1


Simple Serialization errors out, due to the TBufferTransport not flushing the data into TMemoryBuffer after $object->write($protocol) in TBinarySerializer.
Please find the error output of my test program below. It fixed after I added the following line on the serialize method in TBinarySerializer.

$protocol->getTransport()->flush();

This because of TBinaryProtocolAccelerated internally wraps TMemoryBuffer within TBufferTransport in its constructor.

 TBufferTransport write only if the wbuf_ is full (512 bytes) into TMemoryBuffer. Hence data smaller than 512 will not get written into TMemoryBuffer. While getting serialized data from TMemoryBuffer it might not have the last chunk of data which is less than 512 bytes. 

This outputs invalid serialized data 



TestSchema$ php testsimple.php 

Serialized  .
             mari
Fatal error: Uncaught exception 'TTransportException' with message 'TMemoryBuffer: Could not read 512 bytes from buffer.' in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58

TTransportException: TMemoryBuffer: Could not read 512 bytes from buffer. in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58

Call Stack:
    0.0003     636976   1. {main}() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:0
    0.0043    1509728   2. TBinarySerializer::deserialize() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47
    0.0043    1511808   3. thrift_protocol_read_binary() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:62



thrift_protoco_read_binary disabled  ( I commented extension in thrift_protocol.ini) 
 
TestSchema$ php testsimple.php 

Serialized  .
Fatal error: Uncaught exception 'TTransportException' with message 'TMemoryBuffer: Could not read 1 bytes from buffer.' in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58

TTransportException: TMemoryBuffer: Could not read 1 bytes from buffer. in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58

Call Stack:
    0.0003     636976   1. {main}() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:0
    0.0041    1509944   2. TBinarySerializer::deserialize() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47
    0.0041    1512248   3. Person->read() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:66
    0.0041    1512472   4. TBinaryProtocol->readFieldBegin() /Users/mponnambalam/work/eclipse/workspace/TestSchema/gen-php/simple/simple_types.php:45
    0.0041    1512472   5. TBinaryProtocol->readByte() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:231
    0.0041    1512520   6. TBufferedTransport->readAll() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:283
    0.0041    1512568   7. TTransport->readAll() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TBufferedTransport.php:109
    0.0041    1512744   8. TMemoryBuffer->read() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TTransport.php:87


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

        

[jira] [Updated] (THRIFT-1240) TBinarySerializer.php invalid serialization due to TBufferTransport not flushing last chunk of data into TMemoryBuffer

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

Marimuthu Ponnambalam updated THRIFT-1240:
------------------------------------------

    Attachment: testsimple.php

Test file to for simple IDL

> TBinarySerializer.php invalid serialization due to TBufferTransport not flushing last chunk of data into TMemoryBuffer
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1240
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1240
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6.1
>         Environment: Cent OS and Mac OS 10.5
>            Reporter: Marimuthu Ponnambalam
>            Priority: Critical
>              Labels: TBinarySerializer, invalid, serialization
>             Fix For: 0.6.1
>
>         Attachments: simple.thrift, testsimple.php
>
>
> Simple Serialization errors out, due to the TBufferTransport not flushing the data into TMemoryBuffer after $object->write($protocol) in TBinarySerializer.
> Please find the error output of my test program below. It fixed after I added the following line on the serialize method in TBinarySerializer.
> $protocol->getTransport()->flush();
> This because of TBinaryProtocolAccelerated internally wraps TMemoryBuffer within TBufferTransport in its constructor.
>  TBufferTransport write only if the wbuf_ is full (512 bytes) into TMemoryBuffer. Hence data smaller than 512 will not get written into TMemoryBuffer. While getting serialized data from TMemoryBuffer it might not have the last chunk of data which is less than 512 bytes. 
> This outputs invalid serialized data 
> TestSchema$ php testsimple.php 
> Serialized  .
>              mari
> Fatal error: Uncaught exception 'TTransportException' with message 'TMemoryBuffer: Could not read 512 bytes from buffer.' in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> TTransportException: TMemoryBuffer: Could not read 512 bytes from buffer. in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> Call Stack:
>     0.0003     636976   1. {main}() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:0
>     0.0043    1509728   2. TBinarySerializer::deserialize() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47
>     0.0043    1511808   3. thrift_protocol_read_binary() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:62
> thrift_protoco_read_binary disabled  ( I commented extension in thrift_protocol.ini) 
>  
> TestSchema$ php testsimple.php 
> Serialized  .
> Fatal error: Uncaught exception 'TTransportException' with message 'TMemoryBuffer: Could not read 1 bytes from buffer.' in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> TTransportException: TMemoryBuffer: Could not read 1 bytes from buffer. in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> Call Stack:
>     0.0003     636976   1. {main}() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:0
>     0.0041    1509944   2. TBinarySerializer::deserialize() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47
>     0.0041    1512248   3. Person->read() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:66
>     0.0041    1512472   4. TBinaryProtocol->readFieldBegin() /Users/mponnambalam/work/eclipse/workspace/TestSchema/gen-php/simple/simple_types.php:45
>     0.0041    1512472   5. TBinaryProtocol->readByte() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:231
>     0.0041    1512520   6. TBufferedTransport->readAll() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:283
>     0.0041    1512568   7. TTransport->readAll() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TBufferedTransport.php:109
>     0.0041    1512744   8. TMemoryBuffer->read() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TTransport.php:87

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

        

[jira] [Closed] (THRIFT-1240) TBinarySerializer.php invalid serialization due to TBufferTransport not flushing last chunk of data into TMemoryBuffer

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

Jake Farrell closed THRIFT-1240.
--------------------------------

    Resolution: Fixed
      Assignee: Marimuthu Ponnambalam

Thanks for the test case, committed.

> TBinarySerializer.php invalid serialization due to TBufferTransport not flushing last chunk of data into TMemoryBuffer
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1240
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1240
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6.1
>         Environment: Cent OS and Mac OS 10.5
>            Reporter: Marimuthu Ponnambalam
>            Assignee: Marimuthu Ponnambalam
>            Priority: Critical
>              Labels: TBinarySerializer, invalid, serialization
>             Fix For: 0.8
>
>         Attachments: TBinarySerializer.php, simple.thrift, testsimple.php
>
>
> Simple Serialization errors out, due to the TBufferTransport not flushing the data into TMemoryBuffer after $object->write($protocol) in TBinarySerializer.
> Please find the error output of my test program below. It fixed after I added the following line on the serialize method in TBinarySerializer.
> $protocol->getTransport()->flush();
> This because of TBinaryProtocolAccelerated internally wraps TMemoryBuffer within TBufferTransport in its constructor.
>  TBufferTransport write only if the wbuf_ is full (512 bytes) into TMemoryBuffer. Hence data smaller than 512 will not get written into TMemoryBuffer. While getting serialized data from TMemoryBuffer it might not have the last chunk of data which is less than 512 bytes. 
> This outputs invalid serialized data 
> TestSchema$ php testsimple.php 
> Serialized  .
>              mari
> Fatal error: Uncaught exception 'TTransportException' with message 'TMemoryBuffer: Could not read 512 bytes from buffer.' in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> TTransportException: TMemoryBuffer: Could not read 512 bytes from buffer. in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> Call Stack:
>     0.0003     636976   1. {main}() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:0
>     0.0043    1509728   2. TBinarySerializer::deserialize() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47
>     0.0043    1511808   3. thrift_protocol_read_binary() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:62
> thrift_protoco_read_binary disabled  ( I commented extension in thrift_protocol.ini) 
>  
> TestSchema$ php testsimple.php 
> Serialized  .
> Fatal error: Uncaught exception 'TTransportException' with message 'TMemoryBuffer: Could not read 1 bytes from buffer.' in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> TTransportException: TMemoryBuffer: Could not read 1 bytes from buffer. in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> Call Stack:
>     0.0003     636976   1. {main}() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:0
>     0.0041    1509944   2. TBinarySerializer::deserialize() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47
>     0.0041    1512248   3. Person->read() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:66
>     0.0041    1512472   4. TBinaryProtocol->readFieldBegin() /Users/mponnambalam/work/eclipse/workspace/TestSchema/gen-php/simple/simple_types.php:45
>     0.0041    1512472   5. TBinaryProtocol->readByte() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:231
>     0.0041    1512520   6. TBufferedTransport->readAll() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:283
>     0.0041    1512568   7. TTransport->readAll() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TBufferedTransport.php:109
>     0.0041    1512744   8. TMemoryBuffer->read() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TTransport.php:87

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

        

[jira] [Updated] (THRIFT-1240) TBinarySerializer.php invalid serialization due to TBufferTransport not flushing last chunk of data into TMemoryBuffer

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

Marimuthu Ponnambalam updated THRIFT-1240:
------------------------------------------

    Attachment: TBinarySerializer.php

Patch: Fixed for invalid serialization

> TBinarySerializer.php invalid serialization due to TBufferTransport not flushing last chunk of data into TMemoryBuffer
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1240
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1240
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6.1
>         Environment: Cent OS and Mac OS 10.5
>            Reporter: Marimuthu Ponnambalam
>            Priority: Critical
>              Labels: TBinarySerializer, invalid, serialization
>             Fix For: 0.6.1
>
>         Attachments: TBinarySerializer.php, simple.thrift, testsimple.php
>
>
> Simple Serialization errors out, due to the TBufferTransport not flushing the data into TMemoryBuffer after $object->write($protocol) in TBinarySerializer.
> Please find the error output of my test program below. It fixed after I added the following line on the serialize method in TBinarySerializer.
> $protocol->getTransport()->flush();
> This because of TBinaryProtocolAccelerated internally wraps TMemoryBuffer within TBufferTransport in its constructor.
>  TBufferTransport write only if the wbuf_ is full (512 bytes) into TMemoryBuffer. Hence data smaller than 512 will not get written into TMemoryBuffer. While getting serialized data from TMemoryBuffer it might not have the last chunk of data which is less than 512 bytes. 
> This outputs invalid serialized data 
> TestSchema$ php testsimple.php 
> Serialized  .
>              mari
> Fatal error: Uncaught exception 'TTransportException' with message 'TMemoryBuffer: Could not read 512 bytes from buffer.' in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> TTransportException: TMemoryBuffer: Could not read 512 bytes from buffer. in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> Call Stack:
>     0.0003     636976   1. {main}() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:0
>     0.0043    1509728   2. TBinarySerializer::deserialize() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47
>     0.0043    1511808   3. thrift_protocol_read_binary() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:62
> thrift_protoco_read_binary disabled  ( I commented extension in thrift_protocol.ini) 
>  
> TestSchema$ php testsimple.php 
> Serialized  .
> Fatal error: Uncaught exception 'TTransportException' with message 'TMemoryBuffer: Could not read 1 bytes from buffer.' in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> TTransportException: TMemoryBuffer: Could not read 1 bytes from buffer. in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> Call Stack:
>     0.0003     636976   1. {main}() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:0
>     0.0041    1509944   2. TBinarySerializer::deserialize() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47
>     0.0041    1512248   3. Person->read() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:66
>     0.0041    1512472   4. TBinaryProtocol->readFieldBegin() /Users/mponnambalam/work/eclipse/workspace/TestSchema/gen-php/simple/simple_types.php:45
>     0.0041    1512472   5. TBinaryProtocol->readByte() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:231
>     0.0041    1512520   6. TBufferedTransport->readAll() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:283
>     0.0041    1512568   7. TTransport->readAll() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TBufferedTransport.php:109
>     0.0041    1512744   8. TMemoryBuffer->read() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TTransport.php:87

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

        

[jira] [Updated] (THRIFT-1240) TBinarySerializer.php invalid serialization due to TBufferTransport not flushing last chunk of data into TMemoryBuffer

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

Marimuthu Ponnambalam updated THRIFT-1240:
------------------------------------------

    Attachment: simple.thrift

Thrift IDL for simple test

> TBinarySerializer.php invalid serialization due to TBufferTransport not flushing last chunk of data into TMemoryBuffer
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1240
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1240
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6.1
>         Environment: Cent OS and Mac OS 10.5
>            Reporter: Marimuthu Ponnambalam
>            Priority: Critical
>              Labels: TBinarySerializer, invalid, serialization
>             Fix For: 0.6.1
>
>         Attachments: simple.thrift
>
>
> Simple Serialization errors out, due to the TBufferTransport not flushing the data into TMemoryBuffer after $object->write($protocol) in TBinarySerializer.
> Please find the error output of my test program below. It fixed after I added the following line on the serialize method in TBinarySerializer.
> $protocol->getTransport()->flush();
> This because of TBinaryProtocolAccelerated internally wraps TMemoryBuffer within TBufferTransport in its constructor.
>  TBufferTransport write only if the wbuf_ is full (512 bytes) into TMemoryBuffer. Hence data smaller than 512 will not get written into TMemoryBuffer. While getting serialized data from TMemoryBuffer it might not have the last chunk of data which is less than 512 bytes. 
> This outputs invalid serialized data 
> TestSchema$ php testsimple.php 
> Serialized  .
>              mari
> Fatal error: Uncaught exception 'TTransportException' with message 'TMemoryBuffer: Could not read 512 bytes from buffer.' in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> TTransportException: TMemoryBuffer: Could not read 512 bytes from buffer. in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> Call Stack:
>     0.0003     636976   1. {main}() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:0
>     0.0043    1509728   2. TBinarySerializer::deserialize() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47
>     0.0043    1511808   3. thrift_protocol_read_binary() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:62
> thrift_protoco_read_binary disabled  ( I commented extension in thrift_protocol.ini) 
>  
> TestSchema$ php testsimple.php 
> Serialized  .
> Fatal error: Uncaught exception 'TTransportException' with message 'TMemoryBuffer: Could not read 1 bytes from buffer.' in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> TTransportException: TMemoryBuffer: Could not read 1 bytes from buffer. in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> Call Stack:
>     0.0003     636976   1. {main}() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:0
>     0.0041    1509944   2. TBinarySerializer::deserialize() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47
>     0.0041    1512248   3. Person->read() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:66
>     0.0041    1512472   4. TBinaryProtocol->readFieldBegin() /Users/mponnambalam/work/eclipse/workspace/TestSchema/gen-php/simple/simple_types.php:45
>     0.0041    1512472   5. TBinaryProtocol->readByte() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:231
>     0.0041    1512520   6. TBufferedTransport->readAll() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:283
>     0.0041    1512568   7. TTransport->readAll() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TBufferedTransport.php:109
>     0.0041    1512744   8. TMemoryBuffer->read() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TTransport.php:87

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

        

[jira] [Updated] (THRIFT-1240) TBinarySerializer.php invalid serialization due to TBufferTransport not flushing last chunk of data into TMemoryBuffer

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

Jake Farrell updated THRIFT-1240:
---------------------------------

    Fix Version/s:     (was: 0.6.1)
                   0.8

> TBinarySerializer.php invalid serialization due to TBufferTransport not flushing last chunk of data into TMemoryBuffer
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1240
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1240
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6.1
>         Environment: Cent OS and Mac OS 10.5
>            Reporter: Marimuthu Ponnambalam
>            Priority: Critical
>              Labels: TBinarySerializer, invalid, serialization
>             Fix For: 0.8
>
>         Attachments: TBinarySerializer.php, simple.thrift, testsimple.php
>
>
> Simple Serialization errors out, due to the TBufferTransport not flushing the data into TMemoryBuffer after $object->write($protocol) in TBinarySerializer.
> Please find the error output of my test program below. It fixed after I added the following line on the serialize method in TBinarySerializer.
> $protocol->getTransport()->flush();
> This because of TBinaryProtocolAccelerated internally wraps TMemoryBuffer within TBufferTransport in its constructor.
>  TBufferTransport write only if the wbuf_ is full (512 bytes) into TMemoryBuffer. Hence data smaller than 512 will not get written into TMemoryBuffer. While getting serialized data from TMemoryBuffer it might not have the last chunk of data which is less than 512 bytes. 
> This outputs invalid serialized data 
> TestSchema$ php testsimple.php 
> Serialized  .
>              mari
> Fatal error: Uncaught exception 'TTransportException' with message 'TMemoryBuffer: Could not read 512 bytes from buffer.' in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> TTransportException: TMemoryBuffer: Could not read 512 bytes from buffer. in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> Call Stack:
>     0.0003     636976   1. {main}() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:0
>     0.0043    1509728   2. TBinarySerializer::deserialize() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47
>     0.0043    1511808   3. thrift_protocol_read_binary() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:62
> thrift_protoco_read_binary disabled  ( I commented extension in thrift_protocol.ini) 
>  
> TestSchema$ php testsimple.php 
> Serialized  .
> Fatal error: Uncaught exception 'TTransportException' with message 'TMemoryBuffer: Could not read 1 bytes from buffer.' in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> TTransportException: TMemoryBuffer: Could not read 1 bytes from buffer. in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> Call Stack:
>     0.0003     636976   1. {main}() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:0
>     0.0041    1509944   2. TBinarySerializer::deserialize() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47
>     0.0041    1512248   3. Person->read() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:66
>     0.0041    1512472   4. TBinaryProtocol->readFieldBegin() /Users/mponnambalam/work/eclipse/workspace/TestSchema/gen-php/simple/simple_types.php:45
>     0.0041    1512472   5. TBinaryProtocol->readByte() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:231
>     0.0041    1512520   6. TBufferedTransport->readAll() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:283
>     0.0041    1512568   7. TTransport->readAll() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TBufferedTransport.php:109
>     0.0041    1512744   8. TMemoryBuffer->read() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TTransport.php:87

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

        

[jira] [Commented] (THRIFT-1240) TBinarySerializer.php invalid serialization due to TBufferTransport not flushing last chunk of data into TMemoryBuffer

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

Hudson commented on THRIFT-1240:
--------------------------------

Integrated in Thrift #238 (See [https://builds.apache.org/job/Thrift/238/])
    Thrift-1240: TBinarySerializer.php invalid serialization due to TBufferTransport not flushing last chunk of data into TMemoryBuffer
Client: php
Patch: Marimuthu Ponnambalam

Simple Serialization errors out, due to the TBufferTransport not flushing the data into TMemoryBuffer after $object->write($protocol) in TBinarySerializer.


> TBinarySerializer.php invalid serialization due to TBufferTransport not flushing last chunk of data into TMemoryBuffer
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1240
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1240
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6.1
>         Environment: Cent OS and Mac OS 10.5
>            Reporter: Marimuthu Ponnambalam
>            Assignee: Marimuthu Ponnambalam
>            Priority: Critical
>              Labels: TBinarySerializer, invalid, serialization
>             Fix For: 0.8
>
>         Attachments: TBinarySerializer.php, simple.thrift, testsimple.php
>
>
> Simple Serialization errors out, due to the TBufferTransport not flushing the data into TMemoryBuffer after $object->write($protocol) in TBinarySerializer.
> Please find the error output of my test program below. It fixed after I added the following line on the serialize method in TBinarySerializer.
> $protocol->getTransport()->flush();
> This because of TBinaryProtocolAccelerated internally wraps TMemoryBuffer within TBufferTransport in its constructor.
>  TBufferTransport write only if the wbuf_ is full (512 bytes) into TMemoryBuffer. Hence data smaller than 512 will not get written into TMemoryBuffer. While getting serialized data from TMemoryBuffer it might not have the last chunk of data which is less than 512 bytes. 
> This outputs invalid serialized data 
> TestSchema$ php testsimple.php 
> Serialized  .
>              mari
> Fatal error: Uncaught exception 'TTransportException' with message 'TMemoryBuffer: Could not read 512 bytes from buffer.' in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> TTransportException: TMemoryBuffer: Could not read 512 bytes from buffer. in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> Call Stack:
>     0.0003     636976   1. {main}() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:0
>     0.0043    1509728   2. TBinarySerializer::deserialize() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47
>     0.0043    1511808   3. thrift_protocol_read_binary() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:62
> thrift_protoco_read_binary disabled  ( I commented extension in thrift_protocol.ini) 
>  
> TestSchema$ php testsimple.php 
> Serialized  .
> Fatal error: Uncaught exception 'TTransportException' with message 'TMemoryBuffer: Could not read 1 bytes from buffer.' in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> TTransportException: TMemoryBuffer: Could not read 1 bytes from buffer. in /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TMemoryBuffer.php on line 58
> Call Stack:
>     0.0003     636976   1. {main}() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:0
>     0.0041    1509944   2. TBinarySerializer::deserialize() /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47
>     0.0041    1512248   3. Person->read() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:66
>     0.0041    1512472   4. TBinaryProtocol->readFieldBegin() /Users/mponnambalam/work/eclipse/workspace/TestSchema/gen-php/simple/simple_types.php:45
>     0.0041    1512472   5. TBinaryProtocol->readByte() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:231
>     0.0041    1512520   6. TBufferedTransport->readAll() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:283
>     0.0041    1512568   7. TTransport->readAll() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TBufferedTransport.php:109
>     0.0041    1512744   8. TMemoryBuffer->read() /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TTransport.php:87

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