php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63465 connect() timeout param does not take effect
Submitted: 2012-11-08 09:14 UTC Modified: 2017-10-24 06:59 UTC
From: ivan dot rysev at gmail dot com Assigned:
Status: Open Package: memcache (PECL)
PHP Version: 5.3.18 OS: ubuntu 12.0.4
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-11-08 09:14 UTC] ivan dot rysev at gmail dot com
Description:
------------
$m = new Memcache();
$m->connect('127.0.0.1',11211,5);

timeout always 1 sec, because:

static void php_mmc_connect (INTERNAL_FUNCTION_PARAMETERS, int persistent) /* 
{{{ */
{
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lll", &host, &host_len, 
&port, 
&timeout, &timeoutms) == FAILURE) { return; }

if (timeoutms < 1) { 
    timeoutms = MEMCACHE_G(default_timeout_ms);
}

mmc->timeout = timeout;
mmc->connect_timeoutms = timeoutms;

...
}

timeoutms = default_timeout_ms = 1000

next: 

static int _mmc_open(mmc_t *mmc, char **error_string, int *errnum TSRMLS_DC) /* 
{{{ */
{
struct timeval tv;

if (mmc->connect_timeoutms > 0) {
	tv = _convert_timeoutms_to_ts(mmc->connect_timeoutms);
} else {
	tv.tv_sec = mmc->timeout;
	tv.tv_usec = 0;
}
...
}

So, tv.tv_sec = 1 sec




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-09 02:17 UTC] hradtke@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: hradtke
 [2017-10-24 06:59 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: hradtke +Assigned To:
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Dec 15 18:01:25 2019 UTC