[jira] [Updated] (THRIFT-1240) TBinarySerializer.php invalid serialization due to TBufferTransport not flushing last chunk of data into TMemoryBuffer
[ 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.00431509728 2. TBinarySerializer::deserialize() > /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47 > 0.00431511808 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.00411509944 2. TBinarySerializer::deserialize() > /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47 > 0.00411512248 3. Person->read() > /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:66 > 0.00411512472 4. TBinaryProtocol->readFieldBegin() > /Users/mponnambalam/work/eclipse/workspace/TestSchema/gen-php/simple/simple_types.php:45 > 0.00411512472 5. TBinaryProtocol->readByte() > /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:231 > 0.00411512520 6. TBufferedTransport->readAll() > /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:283 > 0.00411512568 7. TTransport->readAll() > /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TBufferedTransport.php:109 > 0.00411512744 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
[ 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.00431509728 2. TBinarySerializer::deserialize() > /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47 > 0.00431511808 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.00411509944 2. TBinarySerializer::deserialize() > /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47 > 0.00411512248 3. Person->read() > /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:66 > 0.00411512472 4. TBinaryProtocol->readFieldBegin() > /Users/mponnambalam/work/eclipse/workspace/TestSchema/gen-php/simple/simple_types.php:45 > 0.00411512472 5. TBinaryProtocol->readByte() > /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:231 > 0.00411512520 6. TBufferedTransport->readAll() > /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:283 > 0.00411512568 7. TTransport->readAll() > /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TBufferedTransport.php:109 > 0.00411512744 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
[ 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.00431509728 2. TBinarySerializer::deserialize() > /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47 > 0.00431511808 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.00411509944 2. TBinarySerializer::deserialize() > /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47 > 0.00411512248 3. Person->read() > /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:66 > 0.00411512472 4. TBinaryProtocol->readFieldBegin() > /Users/mponnambalam/work/eclipse/workspace/TestSchema/gen-php/simple/simple_types.php:45 > 0.00411512472 5. TBinaryProtocol->readByte() > /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:231 > 0.00411512520 6. TBufferedTransport->readAll() > /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:283 > 0.00411512568 7. TTransport->readAll() > /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TBufferedTransport.php:109 > 0.00411512744 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
[ 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.00431509728 2. TBinarySerializer::deserialize() > /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47 > 0.00431511808 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.00411509944 2. TBinarySerializer::deserialize() > /Users/mponnambalam/work/eclipse/workspace/TestSchema/testsimple.php:47 > 0.00411512248 3. Person->read() > /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinarySerializer.php:66 > 0.00411512472 4. TBinaryProtocol->readFieldBegin() > /Users/mponnambalam/work/eclipse/workspace/TestSchema/gen-php/simple/simple_types.php:45 > 0.00411512472 5. TBinaryProtocol->readByte() > /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:231 > 0.00411512520 6. TBufferedTransport->readAll() > /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/protocol/TBinaryProtocol.php:283 > 0.00411512568 7. TTransport->readAll() > /Users/mponnambalam/work/eclipse/workspace/thrift0.6.1/lib/php/src/transport/TBufferedTransport.php:109 > 0.00411512744 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