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: 2021-03-25 16:47 UTC
From: ivan dot rysev at gmail dot com Assigned: cmb (profile)
Status: Closed Package: memcache (PECL)
PHP Version: 5.3.18 OS: ubuntu 12.0.4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ivan dot rysev at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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:
 [2021-03-25 16:47 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-03-25 16:47 UTC] cmb@php.net
The official bug tracker for PECL/memcache is now at
<https://github.com/websupport-sk/pecl-memcache/issues>.

So, if this is still an issue with either of the current memcache
versions (4 or 8), please file an issue there.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 20:01:35 2025 UTC