You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "ruslan.usifov (JIRA)" <ji...@apache.org> on 2011/02/18 09:03:12 UTC

[jira] Created: (THRIFT-1067) Tons of bugs in php implementation

Tons of bugs in php implementation
----------------------------------

                 Key: THRIFT-1067
                 URL: https://issues.apache.org/jira/browse/THRIFT-1067
             Project: Thrift
          Issue Type: Bug
          Components: PHP - Library
    Affects Versions: 0.6
            Reporter: ruslan.usifov


PHP version of thrift hold many bugs:

1). Incorrect work with ZTS
2). Hung when work throw thrift transport
3). Memleak in protocol_writeMessageBegin
4). Hung when server close connection, and when php code try reuse same connection
5). Impossible pass realy long values on 32 bit platforms

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

        

[jira] Updated: (THRIFT-1067) Tons of bugs in php implementation

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

ruslan.usifov updated THRIFT-1067:
----------------------------------

    Description: 
PHP version of thrift hold many bugs:

1). Incorrect work with ZTS
2). Hung when work throw thrift framed transport
3). Memleak in protocol_writeMessageBegin
4). Hung when server close connection, and when php code try reuse same connection
5). Impossible pass realy long values on 32 bit platforms

  was:
PHP version of thrift hold many bugs:

1). Incorrect work with ZTS
2). Hung when work throw thrift transport
3). Memleak in protocol_writeMessageBegin
4). Hung when server close connection, and when php code try reuse same connection
5). Impossible pass realy long values on 32 bit platforms


> Tons of bugs in php implementation
> ----------------------------------
>
>                 Key: THRIFT-1067
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1067
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6
>            Reporter: ruslan.usifov
>         Attachments: php.patch
>
>
> PHP version of thrift hold many bugs:
> 1). Incorrect work with ZTS
> 2). Hung when work throw thrift framed transport
> 3). Memleak in protocol_writeMessageBegin
> 4). Hung when server close connection, and when php code try reuse same connection
> 5). Impossible pass realy long values on 32 bit platforms

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

        

[jira] Issue Comment Edited: (THRIFT-1067) Tons of bugs in php implementation

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

ruslan.usifov edited comment on THRIFT-1067 at 2/20/11 9:33 AM:
----------------------------------------------------------------

I explain some of them:

2). Hung when work throw thrift framed transport
In PHPOutputTransport destructor you make flush(), but in PHP_FUNCTION(thrift_protocol_write_binary) you make flash too at the end: transport.flush(), in framed transport this call hung

3). Memleak in protocol_writeMessageBegin
In this function you allocate 3 function agrs (MAKE_STD_ZVAL), but doesn't free them with zval_ptr_dtor. On very long executed scripts this results as 

Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 30084 bytes)

How fast you got this error, depends on your memory_limit config param in php

4). Hung when server close connection, and when php code try reuse same connection
To reproduce:

{code}
<?php
define("LIBPATH", "lib/");

require_once("thrift/Thrift.php");
require_once("thrift/transport/TSocket.php");
require_once("thrift/transport/TFramedTransport.php");
require_once("thrift/protocol/TBinaryProtocol.php");

require_once('Log.php');
require_once('Log/file.php');

require_once(LIBPATH."cassandra/Cassandra.php");
require_once(LIBPATH."cassandra/cassandra_types.php");

$transport = new TFramedTransport(new TSocket("localhost", 9160));
$protocol  = new TBinaryProtocolAccelerated($transport);

$client = new CassandraClient($protocol);
$transport->open();

$client->set_keyspace("test");

$l_supercolumn = new cassandra_SuperColumn(array("name" => '12', "columns" => NULL));
$l_c_or_sc = new cassandra_ColumnOrSuperColumn(array("super_column" => $l_supercolumn));
$l_mutation = new cassandra_Mutation(array("column_or_supercolumn" => $l_c_or_sc));

for($i=0; $i < 10; $i++)
{
	try
	{
		$client->batch_mutate(array('1' => array('test' => array($l_mutation))), cassandra_ConsistencyLevel::QUORUM);
	}
	catch(Exception $e)
	{
		print $e;
		print "\n\n";
	};
};

sleep(30);
?>
{code}


This code when fist time got to batch_mutate, will throw TApplication exception, second attempt will hung in TSocket::readAll, because fread will always return empty data

5). Impossible pass really long values on 32 bit platforms

Try to pass something like this: 4294967296 on 32 bit platform  and look what you get on server. Result will surprise you



      was (Author: tantra):
    I explain some of them:

2). Hung when work throw thrift framed transport
In PHPOutputTransport destructor you make flush(), but in PHP_FUNCTION(thrift_protocol_write_binary) you make flash too at the end: transport.flush(), in framed transport this call hung

3). Memleak in protocol_writeMessageBegin
In this function you allocate 3 function agrs (MAKE_STD_ZVAL), but doesn't free them with zval_ptr_dtor. On very long time scripts this results as 

Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 30084 bytes)

How fast you got this error, depends on your memory_limit config param in php

4). Hung when server close connection, and when php code try reuse same connection
To reproduce:

{code}
<?php
define("LIBPATH", "lib/");

require_once("thrift/Thrift.php");
require_once("thrift/transport/TSocket.php");
require_once("thrift/transport/TFramedTransport.php");
require_once("thrift/protocol/TBinaryProtocol.php");

require_once('Log.php');
require_once('Log/file.php');

require_once(LIBPATH."cassandra/Cassandra.php");
require_once(LIBPATH."cassandra/cassandra_types.php");

$transport = new TFramedTransport(new TSocket("localhost", 9160));
$protocol  = new TBinaryProtocolAccelerated($transport);

$client = new CassandraClient($protocol);
$transport->open();

$client->set_keyspace("test");

$l_supercolumn = new cassandra_SuperColumn(array("name" => '12', "columns" => NULL));
$l_c_or_sc = new cassandra_ColumnOrSuperColumn(array("super_column" => $l_supercolumn));
$l_mutation = new cassandra_Mutation(array("column_or_supercolumn" => $l_c_or_sc));

for($i=0; $i < 10; $i++)
{
	try
	{
		$client->batch_mutate(array('1' => array('test' => array($l_mutation))), cassandra_ConsistencyLevel::QUORUM);
	}
	catch(Exception $e)
	{
		print $e;
		print "\n\n";
	};
};

sleep(30);
?>
{code}


This code when fist time got to batch_mutate, will throw TApplication exception, second attempt will hung in TSocket::readAll, because fread will always return empty data

5). Impossible pass really long values on 32 bit platforms

Try to pass something like this: 4294967296 on 32 bit platform  and look what you get on server. Result will surprise you


  
> Tons of bugs in php implementation
> ----------------------------------
>
>                 Key: THRIFT-1067
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1067
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6
>            Reporter: ruslan.usifov
>         Attachments: php20110219.patch
>
>
> PHP version of thrift hold many bugs:
> 1). Incorrect work with ZTS
> 2). Hung when work throw thrift framed transport
> 3). Memleak in protocol_writeMessageBegin
> 4). Hung when server close connection, and when php code try reuse same connection
> 5). Impossible pass realy long values on 32 bit platforms

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

        

[jira] Commented: (THRIFT-1067) Tons of bugs in php implementation

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

David Reiss commented on THRIFT-1067:
-------------------------------------

The original author of the extension module had this to say:

It's been so long since I dealt with PHP internals that I'm not sure I can
do a good job of validating this patch -- and that's not exactly something
I'm eager to pick up again.

That being said: the ZTS stuff and the memory leak fix in
protocol_writeMessageBegin look probably OK. The exception stuff is also
probably OK. I would make sure that the #include and typedef stuff at the
top to work around Windows' lack of the [u]intXX_t typedefs and some of
the networking headers didn't break the build on UNIXy machines. Not sure
what the correct behaviour is for the changes to the T_[UI]64 conversions.
Given that it's PHP and we're dealing with 64 bit values, it's probably
all undefined behaviour anyway.

> Tons of bugs in php implementation
> ----------------------------------
>
>                 Key: THRIFT-1067
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1067
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6
>            Reporter: ruslan.usifov
>            Assignee: ruslan.usifov
>             Fix For: 0.7
>
>         Attachments: php20110219.patch
>
>
> PHP version of thrift hold many bugs:
> 1). Incorrect work with ZTS
> 2). Hung when work throw thrift framed transport
> 3). Memleak in protocol_writeMessageBegin
> 4). Hung when server close connection, and when php code try reuse same connection
> 5). Impossible pass really long values on 32 bit platforms

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

        

[jira] [Commented] (THRIFT-1067) Tons of bugs in php implementation

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

Jake Farrell commented on THRIFT-1067:
--------------------------------------

Jeff, THRIFT-985 is open for versioning the php client

> Tons of bugs in php implementation
> ----------------------------------
>
>                 Key: THRIFT-1067
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1067
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6
>            Reporter: ruslan.usifov
>            Assignee: ruslan.usifov
>             Fix For: 0.7
>
>         Attachments: php20110219.patch
>
>
> PHP version of thrift hold many bugs:
> 1). Incorrect work with ZTS
> 2). Hung when work throw thrift framed transport
> 3). Memleak in protocol_writeMessageBegin
> 4). Hung when server close connection, and when php code try reuse same connection
> 5). Impossible pass really long values on 32 bit platforms

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

[jira] Commented: (THRIFT-1067) Tons of bugs in php implementation

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

Bryan Duxbury commented on THRIFT-1067:
---------------------------------------

Can any PHP users/devs vouch for this patch? I don't understand what's going on in there.

> Tons of bugs in php implementation
> ----------------------------------
>
>                 Key: THRIFT-1067
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1067
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6
>            Reporter: ruslan.usifov
>         Attachments: php20110219.patch
>
>
> PHP version of thrift hold many bugs:
> 1). Incorrect work with ZTS
> 2). Hung when work throw thrift framed transport
> 3). Memleak in protocol_writeMessageBegin
> 4). Hung when server close connection, and when php code try reuse same connection
> 5). Impossible pass realy long values on 32 bit platforms

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

        

[jira] Commented: (THRIFT-1067) Tons of bugs in php implementation

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

ruslan.usifov commented on THRIFT-1067:
---------------------------------------

>>>Not sure
>>>what the correct behaviour is for the changes to the T_[UI]64 conversions.
>>>Given that it's PHP and we're dealing with 64 bit values, it's probably
>>>all undefined behaviour anyway.

This helps pass cassandra big timestamps in my test environment. It's not very clean, but in may case is acceptable

> Tons of bugs in php implementation
> ----------------------------------
>
>                 Key: THRIFT-1067
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1067
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6
>            Reporter: ruslan.usifov
>            Assignee: ruslan.usifov
>             Fix For: 0.7
>
>         Attachments: php20110219.patch
>
>
> PHP version of thrift hold many bugs:
> 1). Incorrect work with ZTS
> 2). Hung when work throw thrift framed transport
> 3). Memleak in protocol_writeMessageBegin
> 4). Hung when server close connection, and when php code try reuse same connection
> 5). Impossible pass really long values on 32 bit platforms

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

        

[jira] Updated: (THRIFT-1067) Tons of bugs in php implementation

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

ruslan.usifov updated THRIFT-1067:
----------------------------------

    Description: 
PHP version of thrift hold many bugs:

1). Incorrect work with ZTS
2). Hung when work throw thrift framed transport
3). Memleak in protocol_writeMessageBegin
4). Hung when server close connection, and when php code try reuse same connection
5). Impossible pass really long values on 32 bit platforms

  was:
PHP version of thrift hold many bugs:

1). Incorrect work with ZTS
2). Hung when work throw thrift framed transport
3). Memleak in protocol_writeMessageBegin
4). Hung when server close connection, and when php code try reuse same connection
5). Impossible pass realy long values on 32 bit platforms


> Tons of bugs in php implementation
> ----------------------------------
>
>                 Key: THRIFT-1067
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1067
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6
>            Reporter: ruslan.usifov
>         Attachments: php20110219.patch
>
>
> PHP version of thrift hold many bugs:
> 1). Incorrect work with ZTS
> 2). Hung when work throw thrift framed transport
> 3). Memleak in protocol_writeMessageBegin
> 4). Hung when server close connection, and when php code try reuse same connection
> 5). Impossible pass really long values on 32 bit platforms

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

        

[jira] Issue Comment Edited: (THRIFT-1067) Tons of bugs in php implementation

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

ruslan.usifov edited comment on THRIFT-1067 at 2/20/11 9:35 AM:
----------------------------------------------------------------

I explain some of them:

2). Hung when work throw thrift framed transport
In PHPOutputTransport destructor you make flush(), but in PHP_FUNCTION(thrift_protocol_write_binary) you make flash too at the end: transport.flush(), in framed transport this call hung

3). Memleak in protocol_writeMessageBegin
In this function you allocate 3 function agrs (MAKE_STD_ZVAL), but doesn't free them with zval_ptr_dtor. On very long executed scripts this results as 

Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 30084 bytes)

How fast you got this error, depends on your memory_limit config param in php.ini

4). Hung when server close connection, and when php code try reuse same connection
To reproduce:

{code}
<?php
define("LIBPATH", "lib/");

require_once("thrift/Thrift.php");
require_once("thrift/transport/TSocket.php");
require_once("thrift/transport/TFramedTransport.php");
require_once("thrift/protocol/TBinaryProtocol.php");

require_once('Log.php');
require_once('Log/file.php');

require_once(LIBPATH."cassandra/Cassandra.php");
require_once(LIBPATH."cassandra/cassandra_types.php");

$transport = new TFramedTransport(new TSocket("localhost", 9160));
$protocol  = new TBinaryProtocolAccelerated($transport);

$client = new CassandraClient($protocol);
$transport->open();

$client->set_keyspace("test");

$l_supercolumn = new cassandra_SuperColumn(array("name" => '12', "columns" => NULL));
$l_c_or_sc = new cassandra_ColumnOrSuperColumn(array("super_column" => $l_supercolumn));
$l_mutation = new cassandra_Mutation(array("column_or_supercolumn" => $l_c_or_sc));

for($i=0; $i < 10; $i++)
{
	try
	{
		$client->batch_mutate(array('1' => array('test' => array($l_mutation))), cassandra_ConsistencyLevel::QUORUM);
	}
	catch(Exception $e)
	{
		print $e;
		print "\n\n";
	};
};

sleep(30);
?>
{code}


This code when fist time got to batch_mutate, will throw TApplication exception, second attempt will hung in TSocket::readAll, because fread will always return empty data

5). Impossible pass really long values on 32 bit platforms

Try to pass something like this: 4294967296 on 32 bit platform  and look what you get on server. Result will surprise you



      was (Author: tantra):
    I explain some of them:

2). Hung when work throw thrift framed transport
In PHPOutputTransport destructor you make flush(), but in PHP_FUNCTION(thrift_protocol_write_binary) you make flash too at the end: transport.flush(), in framed transport this call hung

3). Memleak in protocol_writeMessageBegin
In this function you allocate 3 function agrs (MAKE_STD_ZVAL), but doesn't free them with zval_ptr_dtor. On very long executed scripts this results as 

Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 30084 bytes)

How fast you got this error, depends on your memory_limit config param in php

4). Hung when server close connection, and when php code try reuse same connection
To reproduce:

{code}
<?php
define("LIBPATH", "lib/");

require_once("thrift/Thrift.php");
require_once("thrift/transport/TSocket.php");
require_once("thrift/transport/TFramedTransport.php");
require_once("thrift/protocol/TBinaryProtocol.php");

require_once('Log.php');
require_once('Log/file.php');

require_once(LIBPATH."cassandra/Cassandra.php");
require_once(LIBPATH."cassandra/cassandra_types.php");

$transport = new TFramedTransport(new TSocket("localhost", 9160));
$protocol  = new TBinaryProtocolAccelerated($transport);

$client = new CassandraClient($protocol);
$transport->open();

$client->set_keyspace("test");

$l_supercolumn = new cassandra_SuperColumn(array("name" => '12', "columns" => NULL));
$l_c_or_sc = new cassandra_ColumnOrSuperColumn(array("super_column" => $l_supercolumn));
$l_mutation = new cassandra_Mutation(array("column_or_supercolumn" => $l_c_or_sc));

for($i=0; $i < 10; $i++)
{
	try
	{
		$client->batch_mutate(array('1' => array('test' => array($l_mutation))), cassandra_ConsistencyLevel::QUORUM);
	}
	catch(Exception $e)
	{
		print $e;
		print "\n\n";
	};
};

sleep(30);
?>
{code}


This code when fist time got to batch_mutate, will throw TApplication exception, second attempt will hung in TSocket::readAll, because fread will always return empty data

5). Impossible pass really long values on 32 bit platforms

Try to pass something like this: 4294967296 on 32 bit platform  and look what you get on server. Result will surprise you


  
> Tons of bugs in php implementation
> ----------------------------------
>
>                 Key: THRIFT-1067
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1067
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6
>            Reporter: ruslan.usifov
>         Attachments: php20110219.patch
>
>
> PHP version of thrift hold many bugs:
> 1). Incorrect work with ZTS
> 2). Hung when work throw thrift framed transport
> 3). Memleak in protocol_writeMessageBegin
> 4). Hung when server close connection, and when php code try reuse same connection
> 5). Impossible pass really long values on 32 bit platforms

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

        

[jira] Updated: (THRIFT-1067) Tons of bugs in php implementation

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

ruslan.usifov updated THRIFT-1067:
----------------------------------

    Attachment: php.patch

> Tons of bugs in php implementation
> ----------------------------------
>
>                 Key: THRIFT-1067
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1067
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6
>            Reporter: ruslan.usifov
>         Attachments: php.patch
>
>
> PHP version of thrift hold many bugs:
> 1). Incorrect work with ZTS
> 2). Hung when work throw thrift transport
> 3). Memleak in protocol_writeMessageBegin
> 4). Hung when server close connection, and when php code try reuse same connection
> 5). Impossible pass realy long values on 32 bit platforms

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

        

[jira] Issue Comment Edited: (THRIFT-1067) Tons of bugs in php implementation

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

ruslan.usifov edited comment on THRIFT-1067 at 2/20/11 9:35 AM:
----------------------------------------------------------------

I explain some of them:

2). Hung when work throw thrift framed transport
In PHPOutputTransport destructor you make flush(), but in PHP_FUNCTION(thrift_protocol_write_binary) you make flash too at the end: transport.flush(), in framed transport this call hung

3). Memleak in protocol_writeMessageBegin
In this function you allocate 3 function agrs (MAKE_STD_ZVAL), but doesn't free them with zval_ptr_dtor. On very long executed scripts this results as 

Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 30084 bytes)

How fast you got this error, depends on your memory_limit config param in php.ini

4). Hung when server close connection, and when php code try reuse same connection
To reproduce:

{code}
<?php
define("LIBPATH", "lib/");

require_once("thrift/Thrift.php");
require_once("thrift/transport/TSocket.php");
require_once("thrift/transport/TFramedTransport.php");
require_once("thrift/protocol/TBinaryProtocol.php");

require_once('Log.php');
require_once('Log/file.php');

require_once(LIBPATH."cassandra/Cassandra.php");
require_once(LIBPATH."cassandra/cassandra_types.php");

$transport = new TFramedTransport(new TSocket("localhost", 9160));
$protocol  = new TBinaryProtocolAccelerated($transport);

$client = new CassandraClient($protocol);
$transport->open();

$client->set_keyspace("test");

$l_supercolumn = new cassandra_SuperColumn(array("name" => '12', "columns" => NULL));
$l_c_or_sc = new cassandra_ColumnOrSuperColumn(array("super_column" => $l_supercolumn));
$l_mutation = new cassandra_Mutation(array("column_or_supercolumn" => $l_c_or_sc));

for($i=0; $i < 10; $i++)
{
	try
	{
		$client->batch_mutate(array('1' => array('test' => array($l_mutation))), cassandra_ConsistencyLevel::QUORUM);
	}
	catch(Exception $e)
	{
		print $e;
		print "\n\n";
	};
};

sleep(30);
?>
{code}


This code when fist time go to batch_mutate, will throw TApplication exception, second attempt will hung in TSocket::readAll, because fread will always return empty data

5). Impossible pass really long values on 32 bit platforms

Try to pass something like this: 4294967296 on 32 bit platform  and look what you get on server. Result will surprise you



      was (Author: tantra):
    I explain some of them:

2). Hung when work throw thrift framed transport
In PHPOutputTransport destructor you make flush(), but in PHP_FUNCTION(thrift_protocol_write_binary) you make flash too at the end: transport.flush(), in framed transport this call hung

3). Memleak in protocol_writeMessageBegin
In this function you allocate 3 function agrs (MAKE_STD_ZVAL), but doesn't free them with zval_ptr_dtor. On very long executed scripts this results as 

Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 30084 bytes)

How fast you got this error, depends on your memory_limit config param in php.ini

4). Hung when server close connection, and when php code try reuse same connection
To reproduce:

{code}
<?php
define("LIBPATH", "lib/");

require_once("thrift/Thrift.php");
require_once("thrift/transport/TSocket.php");
require_once("thrift/transport/TFramedTransport.php");
require_once("thrift/protocol/TBinaryProtocol.php");

require_once('Log.php');
require_once('Log/file.php');

require_once(LIBPATH."cassandra/Cassandra.php");
require_once(LIBPATH."cassandra/cassandra_types.php");

$transport = new TFramedTransport(new TSocket("localhost", 9160));
$protocol  = new TBinaryProtocolAccelerated($transport);

$client = new CassandraClient($protocol);
$transport->open();

$client->set_keyspace("test");

$l_supercolumn = new cassandra_SuperColumn(array("name" => '12', "columns" => NULL));
$l_c_or_sc = new cassandra_ColumnOrSuperColumn(array("super_column" => $l_supercolumn));
$l_mutation = new cassandra_Mutation(array("column_or_supercolumn" => $l_c_or_sc));

for($i=0; $i < 10; $i++)
{
	try
	{
		$client->batch_mutate(array('1' => array('test' => array($l_mutation))), cassandra_ConsistencyLevel::QUORUM);
	}
	catch(Exception $e)
	{
		print $e;
		print "\n\n";
	};
};

sleep(30);
?>
{code}


This code when fist time got to batch_mutate, will throw TApplication exception, second attempt will hung in TSocket::readAll, because fread will always return empty data

5). Impossible pass really long values on 32 bit platforms

Try to pass something like this: 4294967296 on 32 bit platform  and look what you get on server. Result will surprise you


  
> Tons of bugs in php implementation
> ----------------------------------
>
>                 Key: THRIFT-1067
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1067
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6
>            Reporter: ruslan.usifov
>         Attachments: php20110219.patch
>
>
> PHP version of thrift hold many bugs:
> 1). Incorrect work with ZTS
> 2). Hung when work throw thrift framed transport
> 3). Memleak in protocol_writeMessageBegin
> 4). Hung when server close connection, and when php code try reuse same connection
> 5). Impossible pass really long values on 32 bit platforms

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

        

[jira] Closed: (THRIFT-1067) Tons of bugs in php implementation

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

Bryan Duxbury closed THRIFT-1067.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 0.7
         Assignee: ruslan.usifov

I just committed this. Thanks for the patch, Ruslan!

> Tons of bugs in php implementation
> ----------------------------------
>
>                 Key: THRIFT-1067
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1067
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6
>            Reporter: ruslan.usifov
>            Assignee: ruslan.usifov
>             Fix For: 0.7
>
>         Attachments: php20110219.patch
>
>
> PHP version of thrift hold many bugs:
> 1). Incorrect work with ZTS
> 2). Hung when work throw thrift framed transport
> 3). Memleak in protocol_writeMessageBegin
> 4). Hung when server close connection, and when php code try reuse same connection
> 5). Impossible pass really long values on 32 bit platforms

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

        

[jira] Updated: (THRIFT-1067) Tons of bugs in php implementation

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

ruslan.usifov updated THRIFT-1067:
----------------------------------

    Attachment: php20110219.patch

> Tons of bugs in php implementation
> ----------------------------------
>
>                 Key: THRIFT-1067
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1067
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6
>            Reporter: ruslan.usifov
>         Attachments: php20110219.patch
>
>
> PHP version of thrift hold many bugs:
> 1). Incorrect work with ZTS
> 2). Hung when work throw thrift framed transport
> 3). Memleak in protocol_writeMessageBegin
> 4). Hung when server close connection, and when php code try reuse same connection
> 5). Impossible pass realy long values on 32 bit platforms

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

        

[jira] Updated: (THRIFT-1067) Tons of bugs in php implementation

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

ruslan.usifov updated THRIFT-1067:
----------------------------------

    Attachment:     (was: php.patch)

> Tons of bugs in php implementation
> ----------------------------------
>
>                 Key: THRIFT-1067
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1067
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6
>            Reporter: ruslan.usifov
>
> PHP version of thrift hold many bugs:
> 1). Incorrect work with ZTS
> 2). Hung when work throw thrift framed transport
> 3). Memleak in protocol_writeMessageBegin
> 4). Hung when server close connection, and when php code try reuse same connection
> 5). Impossible pass realy long values on 32 bit platforms

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

        

[jira] Commented: (THRIFT-1067) Tons of bugs in php implementation

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

ruslan.usifov commented on THRIFT-1067:
---------------------------------------

I explain some of them:

2). Hung when work throw thrift framed transport
In PHPOutputTransport destructor you make flush(), but in PHP_FUNCTION(thrift_protocol_write_binary) you make flash too at the end: transport.flush(), in framed transport this call hung

3). Memleak in protocol_writeMessageBegin
In this function you allocate 3 function agrs (MAKE_STD_ZVAL), but doesn't free them with zval_ptr_dtor. On very long time scripts this results as 

Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 30084 bytes)

How fast you got this error, depends on your memory_limit config param in php

4). Hung when server close connection, and when php code try reuse same connection
To reproduce:

{code}
<?php
define("LIBPATH", "lib/");

require_once("thrift/Thrift.php");
require_once("thrift/transport/TSocket.php");
require_once("thrift/transport/TFramedTransport.php");
require_once("thrift/protocol/TBinaryProtocol.php");

require_once('Log.php');
require_once('Log/file.php');

require_once(LIBPATH."cassandra/Cassandra.php");
require_once(LIBPATH."cassandra/cassandra_types.php");

$transport = new TFramedTransport(new TSocket("localhost", 9160));
$protocol  = new TBinaryProtocolAccelerated($transport);

$client = new CassandraClient($protocol);
$transport->open();

$client->set_keyspace("test");

$l_supercolumn = new cassandra_SuperColumn(array("name" => '12', "columns" => NULL));
$l_c_or_sc = new cassandra_ColumnOrSuperColumn(array("super_column" => $l_supercolumn));
$l_mutation = new cassandra_Mutation(array("column_or_supercolumn" => $l_c_or_sc));

for($i=0; $i < 10; $i++)
{
	try
	{
		$client->batch_mutate(array('1' => array('test' => array($l_mutation))), cassandra_ConsistencyLevel::QUORUM);
	}
	catch(Exception $e)
	{
		print $e;
		print "\n\n";
	};
};

sleep(30);
?>
{code}


This code when fist time got to batch_mutate, will throw TApplication exception, second attempt will hung in TSocket::readAll, because fread will always return empty data

5). Impossible pass really long values on 32 bit platforms

Try to pass something like this: 4294967296 on 32 bit platform  and look what you get on server. Result will surprise you



> Tons of bugs in php implementation
> ----------------------------------
>
>                 Key: THRIFT-1067
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1067
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6
>            Reporter: ruslan.usifov
>         Attachments: php20110219.patch
>
>
> PHP version of thrift hold many bugs:
> 1). Incorrect work with ZTS
> 2). Hung when work throw thrift framed transport
> 3). Memleak in protocol_writeMessageBegin
> 4). Hung when server close connection, and when php code try reuse same connection
> 5). Impossible pass realy long values on 32 bit platforms

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

        

[jira] [Commented] (THRIFT-1067) Tons of bugs in php implementation

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

Jeff Whiting commented on THRIFT-1067:
--------------------------------------

I think the php thrift extension version number should be incremented whenever a bug fix / change is made to the extension.  Right now it is still at 1.0 but it should be 1.0.1 or 1.1 after applying this patch.  That way when people have problems you can have them check their extension version and know if they have the latest one installed with all the bug fixes.

> Tons of bugs in php implementation
> ----------------------------------
>
>                 Key: THRIFT-1067
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1067
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.6
>            Reporter: ruslan.usifov
>            Assignee: ruslan.usifov
>             Fix For: 0.7
>
>         Attachments: php20110219.patch
>
>
> PHP version of thrift hold many bugs:
> 1). Incorrect work with ZTS
> 2). Hung when work throw thrift framed transport
> 3). Memleak in protocol_writeMessageBegin
> 4). Hung when server close connection, and when php code try reuse same connection
> 5). Impossible pass really long values on 32 bit platforms

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