php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58838 Unable to store columns: recv error after approx 200K inserts
Submitted: 2009-08-29 04:57 UTC Modified: 2009-09-04 04:06 UTC
From: mansion@php.net Assigned:
Status: Closed Package: tokyo_tyrant (PECL)
PHP Version: 5.2.10 OS: Linux Centos 5.3
Private report: No CVE-ID: None
 [2009-08-29 04:57 UTC] mansion@php.net
Description:
------------
I have a MySQL database with 250000 records which I try to 
convert to a Tokyo Cabinet Table database and I use this 
extension for that.

After approximately 200000 records get inserted, my code 
throws an exception "Unable to store columns: recv error". 
Further tries to insert throw the same exception. So it 
seems the socket cannot recv anymore.

I also tried with my own Tokyo Tyrant wrapper which is 
written in PHP and it works. So I think there might be 
something wrong in the extension regarding the way sockets 
are handled/released ?

It does the same thing whether connection is persistent or 
not.

Reproduce code:
---------------
foreach ($pdo->query("SELECT * FROM message") as $row) {
    try {

    $msg = array();
    $msg['subject'] = $row['msg_subject'];
    $msg['from'] = mb_convert_encoding($row['msg_from'], 'UTF-8');
    $msg['date'] = $row['msg_date'];
    $msg['messageid'] = $row['msg_id'];
    $msg['list'] = $lists[$row['msg_fkmlist']];
    $msg['inreplyto'] = $row['msg_inreplyto'];
    $msg['body'] = mb_convert_encoding($row['msg_body'], 'UTF-8');
    $tt->put($row['pkmessage'], $msg);
    } catch (Exception $e) {
        var_dump($e);exit;
    }
}


Actual result:
--------------
Unable to store columns: recv error

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-03 15:43 UTC] mkoppanen@php.net
Hello,

the default timeout setting might be slightly too strict. Can you test the same code with following connect call:

$tt = new TokyoTyrant("youserver", 1978, array("timeout" => 5.0);

Does it get through the code?
 [2009-09-03 15:43 UTC] mkoppanen@php.net
Missing a closing ) there but you get the point :)
 [2009-09-04 02:45 UTC] php at mamasam dot net
That did the trick, thank you :)

Maybe we could add a new function to set the timeout and 
other options after the connection is opened, for example 
setTimeout() or setOptions()?

The documentation for the constructor and ::connect() is 
wrong for the last parameter : 
http://fr.php.net/manual/en/tokyotyrant.__construct.php
 [2009-09-04 04:06 UTC] mkoppanen@php.net
Updated docs, added tune method to change timeout and disabled timeout by default.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 23:01:34 2024 UTC