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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
25 - 19 = ?
Subscribe to this entry?

 
 [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:
 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 00:01:28 2024 UTC