You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Kevin Bombino (JIRA)" <ji...@apache.org> on 2010/06/24 21:03:52 UTC

[jira] Issue Comment Edited: (THRIFT-347) PHP TSocket Timeout Issues

    [ https://issues.apache.org/jira/browse/THRIFT-347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12830393#action_12830393 ] 

Kevin Bombino edited comment on THRIFT-347 at 6/24/10 3:02 PM:
---------------------------------------------------------------

+1 for the patch.  Solved TSocket timeout issues on CentOS 5.3,  PHP 5.2,  talking to a Ruby Thrift server running on localhost.  I have no idea how it solves the problem, or what was causing the problem, but we've been using this patch in production for a few months with no further errors.

EDIT:  upon further review, while this patch did prevent errors from being shown, it did not address the root issue.  Sorry for adding confusion to the matter.

      was (Author: bombino):
    +1 for the patch.  Solved TSocket timeout issues on CentOS 5.3,  PHP 5.2,  talking to a Ruby Thrift server running on localhost.  I have no idea how it solves the problem, or what was causing the problem, but we've been using this patch in production for a few months with no further errors.
  
> PHP TSocket Timeout Issues
> --------------------------
>
>                 Key: THRIFT-347
>                 URL: https://issues.apache.org/jira/browse/THRIFT-347
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (PHP)
>         Environment: Fedora 8, 64bit, php 5.2.4
>            Reporter: Gary Richardson
>         Attachments: TSocket.php.diff
>
>
> I'm working with the Hive thrift service and I get the following exception when I execute a SELECT statement:
> PHP Fatal error:  Uncaught exception 'TException' with message 'TSocket: timed out reading 4 bytes from localhost:10000' in /root/leap/dev/servers/hive/thriftroot/
> transport/TSocket.php:228
> Stack trace:
> #0 /root/leap/dev/servers/hive/thriftroot/protocol/TBinaryProtocol.php(292): TSocket->readAll(4)
> #1 /root/leap/dev/servers/hive/thriftroot/protocol/TBinaryProtocol.php(184): TBinaryProtocol->readI32(NULL)
> #2 /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php(59): TBinaryProtocol->readMessageBegin(NULL, 0, 0)
> #3 /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php(28): ThriftHiveClient->recv_execute()
> #4 /root/leap/dev/servers/hive/testscript.php(30): ThriftHiveClient->execute('SELECT num FROM...')
> #5 {main}
>   thrown in /root/leap/dev/servers/hive/thriftroot/transport/TSocket.php on line 228
> The script I'm using to cause this is:
> ======================================
> #!/usr/bin/php
> <?php
> $GLOBALS['THRIFT_ROOT'] = 'thriftroot/';
> require_once $GLOBALS['THRIFT_ROOT'] . 'packages/hive_service/ThriftHive.php';
> require_once $GLOBALS['THRIFT_ROOT'] . 'transport/TSocket.php';
> require_once $GLOBALS['THRIFT_ROOT'] . 'protocol/TBinaryProtocol.php';
> $transport = new TSocket('localhost', 10000);
> $protocol = new TBinaryProtocol($transport);
> $client = new ThriftHiveClient($protocol);
> $transport->open();
> try
> {
>     $client->execute('DROP TABLE testOverThrift');
> }
> catch (Exception $e)
> {
>     error_log("Got exception while trying to drop table: " . $e->getMessage());
> }
> $client->execute('CREATE TABLE testOverThrift (num int)');
> $client->execute('LOAD DATA LOCAL
> 		 INPATH "/root/testdata.txt"
> 		 INTO TABLE testOverThrift');
> $client->execute('SELECT num FROM testOverThrift WHERE num < 5');
> $result = $client->fetchAll();
> var_dump($result);
> ==================================
> I have a patch that fixes the problem that I'll attach. It looks like fetchAll() doesn't know the difference between a timeout and a blocking port.

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