You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by "kondo@vivinavi.com" <ko...@vivinavi.com> on 2011/03/12 04:03:46 UTC

TException: Error: TSocket: Could not read 1024 bytes from localhost:9160

Hi Everyone

I am new to Cassandra and Thrift and Java.
I started to install JDK1.6 , Cassandra 0.7.3 and Thrift 0.5.0 for PHP.
My server system is as following.
Debian 5.0.8
PHP 5.2.6-1+lenny 9
OpenJDK1.6.0.24 (Unfortunately I couldn't find sunJDK1.6)
Cassandra 0.7.3
Thrift 0.5.0
Now Cassandra-Cli is working.
I set data Keyspace1 and get data on Cassandra-Cli.
Then I tried to run your sample program.
However I have a following error at function:thrift_protocol_read_binary.
TException: Error: TSocket: Could not read 1024 bytes from localhost:9160
I checked php_thrift_protocol.cpp.
Then I recognized this error happened at the following line in
PHP_FUNCTION(thrift_protocol_read_binary).
int32_t sz = transport.readI32();
Now I don't know how to solve this problem.
And please let me know where is this function transport.readI32 from?
Please advise me how to do or what am I wrong?

Thank you for your help in advance.
-- 

*************************
Mamoru Kondo
Vivid Navigation,Inc.
http://www.vivinavi.com
kondo@vivinavi.com
Office:310-326-2900
Fax:310-257-0051
*************************


Re: TException: Error: TSocket: Could not read 1024 bytes from localhost:9160

Posted by "kondo@vivinavi.com" <ko...@vivinavi.com>.
Hi
Thank you for your help.
So I installed phpcassa from https://github.com/hoan/phpcassa/
Then I tried very simple insert program based on README.
However I have still following error at thrift_protocol_read_binary.

Fatal error: Uncaught exception 'TException' with message 'TSocket: 
Could not read 1024 bytes from localhost:9160' in 
/usr/share/php5/Thrift/thrift/transport/TSocket.php:267
Stack trace:
#0 /usr/share/php5/Thrift/thrift/transport/TBufferedTransport.php(126): 
TSocket->read(1024)
#1 [internal function]: TBufferedTransport->read(8192)
#2 /usr/share/php5/Thrift/thrift/packages/cassandra/Cassandra.php(764): 
thrift_protocol_read_binary(Object(TBinaryProtocolAccelerated), 
'cassandra_Cassa...', false)
#3 /usr/share/php5/Thrift/thrift/packages/cassandra/Cassandra.php(736): 
CassandraClient->recv_batch_mutate()
#4 /usr/share/php5/Thrift/phpcassa.php(286): 
CassandraClient->batch_mutate('Keyspace1', Array, 0)
#5 /var/www/thrift/unoh/PicassaSample.php(27): CassandraCF->insert('1', 
Array)
#6 {main}
   thrown in /usr/share/php5/Thrift/thrift/transport/TSocket.php on line 267


my program(PicassaSample.php) is very simple as following.
<?php
$GLOBALS['THRIFT_ROOT'] = '/usr/share/php5/Thrift/thrift';
require_once $GLOBALS['THRIFT_ROOT'].'/packages/cassandra/Cassandra.php';
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TSocket.php';
require_once $GLOBALS['THRIFT_ROOT'].'/protocol/TBinaryProtocol.php';
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TFramedTransport.php';
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TBufferedTransport.php';
include_once '/usr/share/php5/Thrift/phpcassa.php';
include_once '/usr/share/php5/Thrift/uuid.php';

CassandraConn::add_node('localhost', 9160);
$users = new CassandraCF('Keyspace1', 'Users'); // ColumnFamily
$users->insert('1', array('email' => 'hoan.tonthat@gmail.com', 
'password' => 'test'));
?>

What am I wrong?
Thank you for your help in advance.



(2011/03/11 20:03), Jonathan Ellis wrote:
> you should use phpcassa, it includes a version of thrift that has this
> bug fixed.
>
> 2011/3/11 kondo@vivinavi.com<ko...@vivinavi.com>:
>> Hi Everyone
>>
>> I am new to Cassandra and Thrift and Java.
>> I started to install JDK1.6 , Cassandra 0.7.3 and Thrift 0.5.0 for PHP.
>> My server system is as following.
>> Debian 5.0.8
>> PHP 5.2.6-1+lenny 9
>> OpenJDK1.6.0.24 (Unfortunately I couldn't find sunJDK1.6)
>> Cassandra 0.7.3
>> Thrift 0.5.0
>> Now Cassandra-Cli is working.
>> I set data Keyspace1 and get data on Cassandra-Cli.
>> Then I tried to run your sample program.
>> However I have a following error at function:thrift_protocol_read_binary.
>> TException: Error: TSocket: Could not read 1024 bytes from localhost:9160
>> I checked php_thrift_protocol.cpp.
>> Then I recognized this error happened at the following line in
>> PHP_FUNCTION(thrift_protocol_read_binary).
>> int32_t sz = transport.readI32();
>> Now I don't know how to solve this problem.
>> And please let me know where is this function transport.readI32 from?
>> Please advise me how to do or what am I wrong?
>>
>> Thank you for your help in advance.
>> --
>>
>> *************************
>> Mamoru Kondo
>> Vivid Navigation,Inc.
>> http://www.vivinavi.com
>> kondo@vivinavi.com
>> Office:310-326-2900
>> Fax:310-257-0051
>> *************************
>>
>>
>
>


-- 
*************************
Mamoru Kondo
Vivid Navigation,Inc.
http://www.vivinavi.com
kondo@vivinavi.com
Office:310-326-2900
Fax:310-257-0051
*************************


Re: TException: Error: TSocket: Could not read 1024 bytes from localhost:9160

Posted by Jonathan Ellis <jb...@gmail.com>.
you should use phpcassa, it includes a version of thrift that has this
bug fixed.

2011/3/11 kondo@vivinavi.com <ko...@vivinavi.com>:
> Hi Everyone
>
> I am new to Cassandra and Thrift and Java.
> I started to install JDK1.6 , Cassandra 0.7.3 and Thrift 0.5.0 for PHP.
> My server system is as following.
> Debian 5.0.8
> PHP 5.2.6-1+lenny 9
> OpenJDK1.6.0.24 (Unfortunately I couldn't find sunJDK1.6)
> Cassandra 0.7.3
> Thrift 0.5.0
> Now Cassandra-Cli is working.
> I set data Keyspace1 and get data on Cassandra-Cli.
> Then I tried to run your sample program.
> However I have a following error at function:thrift_protocol_read_binary.
> TException: Error: TSocket: Could not read 1024 bytes from localhost:9160
> I checked php_thrift_protocol.cpp.
> Then I recognized this error happened at the following line in
> PHP_FUNCTION(thrift_protocol_read_binary).
> int32_t sz = transport.readI32();
> Now I don't know how to solve this problem.
> And please let me know where is this function transport.readI32 from?
> Please advise me how to do or what am I wrong?
>
> Thank you for your help in advance.
> --
>
> *************************
> Mamoru Kondo
> Vivid Navigation,Inc.
> http://www.vivinavi.com
> kondo@vivinavi.com
> Office:310-326-2900
> Fax:310-257-0051
> *************************
>
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com