Re: [PHP] Memcache problems

2011-02-04 Thread Jostein Eriksen
Thanks for your help so far. I've just started noticing a bunch of 
zend_mm_heap corrupted in logs, Could this be the reason?


On 02/03/2011 11:12 PM, Alex Nikitin wrote:

Short of some process going crazy, which you should check for, some psing,
top and netstat, i cant think of any reason you should ever get a connection
drop, short of a hardware failure (memory perhaps), or an experimental
kernel settings or modules or something... i cant think of any way that a
connection to 127.0.0.1 would ever possibly get dropped, loopback device
never hits your network hardware...

~Alex

On Thu, Feb 3, 2011 at 5:00 PM, Jostein Eriksenphp-l...@morits.net  wrote:


On 02/03/2011 10:49 PM, Adam Richardson wrote:


On Thu, Feb 3, 2011 at 4:19 PM, Jostein Eriksenphp-l...@morits.net
  wrote:

  Both php and memcached is running on the same server.

memcached version 1.2.2
php5-memcache version 2.2.0
php version 5.2.4

here is a snippet from my code that may be of interest
$cfg['serverList'] = array('127.0.0.1', 11211, 1, 1);
...
$this-memcache = new Memcache();
foreach($cfg['serverList'] as $value){
/** host, port, persistent, weight,
timeout,
retry interval, status, failure callback */
$this-memcache-addServer($value[0],
$value[1], false, $value[2], $value[3], 2, true, array($this, 'fail'));
}


  Are you sure you copied this correctly?


In the code above, you set the array key 'serverList' to an array
containing
('127.0.0.1', 11211, 1, 1);

Then, you foreach through the values of the 'serverList' array (first
iteration, value would equal '127.0.0.1', second, value would equal 11211,
etc.)

Then, you use array notation to access the first position of $value.  In
the
first iteration of the foreach, $value would equal '127.0.0.1', so
$value[0]
would give you '1', $value[1] would give you '2', etc.

Do you see what I'm saying? Did you forget or omit other relevant code?
Or,
I'm just having a really bad code day (in this case, I'll likely see my
error just after sending this email.)

Adam



My bad.

it should be:
'serverList' =  array(
/** host, port, weight, timeout */
'default' =  array('127.0.0.1',
11211, 1, 1),
)),

Didn't copy/paste the $cfg = line, so it got messed up.

/Jostein

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php







--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Memcache problems

2011-02-03 Thread Alex Nikitin
There could be many a reasons for this, and it really depends on your setup.
For example, is php and memcache on the same server, if they are not what is
the network topology like, it could be a piece of hardware starting to
malfunction, it could be an issue with the networking driver, on the other
hand it could be neither; but to help you figure out where to look, one
should hope to see a little bit more info...

~Alex

On Thu, Feb 3, 2011 at 3:10 PM, Jostein Eriksen php-l...@morits.net wrote:

 Hi,

 I've been having some problems with memcache lately.
 It seems to me that php is dropping connection to the memcache server mid
 way through the scripts.
 I've sat the failure_callback to log failures. And I'm getting a lot of
 them. Several every minute.

 I'm quite stuck now and realy dont know where to go from here.
 I've tried to telnet into the server. And there is no problem with either
 set nor get commands. I've started the memcached daemon with -vvv to see if
 I can dig anything interesting from the logs, but I can find no errors of
 any kind in them. There is also no errors that I can find in the php_error
 log.

 I would appreciate some help, if anyone have any ideas of what is going on.

 thanks.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Memcache problems

2011-02-03 Thread Jostein Eriksen

Both php and memcached is running on the same server.
memcached version 1.2.2
php5-memcache version 2.2.0
php version 5.2.4

here is a snippet from my code that may be of interest
$cfg['serverList'] = array('127.0.0.1', 11211, 1, 1);
...
$this-memcache = new Memcache();
foreach($cfg['serverList'] as $value){
/** host, port, persistent, weight, timeout, retry interval, status, 
failure callback */
$this-memcache-addServer($value[0], $value[1], false, $value[2], 
$value[3], 2, true, array($this, 'fail'));

}

/Jostein

On 02/03/2011 09:34 PM, Alex Nikitin wrote:

There could be many a reasons for this, and it really depends on your setup.
For example, is php and memcache on the same server, if they are not what is
the network topology like, it could be a piece of hardware starting to
malfunction, it could be an issue with the networking driver, on the other
hand it could be neither; but to help you figure out where to look, one
should hope to see a little bit more info...

~Alex

On Thu, Feb 3, 2011 at 3:10 PM, Jostein Eriksenphp-l...@morits.net  wrote:


Hi,

I've been having some problems with memcache lately.
It seems to me that php is dropping connection to the memcache server mid
way through the scripts.
I've sat the failure_callback to log failures. And I'm getting a lot of
them. Several every minute.

I'm quite stuck now and realy dont know where to go from here.
I've tried to telnet into the server. And there is no problem with either
set nor get commands. I've started the memcached daemon with -vvv to see if
I can dig anything interesting from the logs, but I can find no errors of
any kind in them. There is also no errors that I can find in the php_error
log.

I would appreciate some help, if anyone have any ideas of what is going on.

thanks.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php







--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Memcache problems

2011-02-03 Thread Adam Richardson
On Thu, Feb 3, 2011 at 4:19 PM, Jostein Eriksen php-l...@morits.net wrote:

 Both php and memcached is running on the same server.
 memcached version 1.2.2
 php5-memcache version 2.2.0
 php version 5.2.4

 here is a snippet from my code that may be of interest
 $cfg['serverList'] = array('127.0.0.1', 11211, 1, 1);
 ...
 $this-memcache = new Memcache();
 foreach($cfg['serverList'] as $value){
/** host, port, persistent, weight, timeout,
 retry interval, status, failure callback */
$this-memcache-addServer($value[0],
 $value[1], false, $value[2], $value[3], 2, true, array($this, 'fail'));
}


Are you sure you copied this correctly?

In the code above, you set the array key 'serverList' to an array containing
('127.0.0.1', 11211, 1, 1);

Then, you foreach through the values of the 'serverList' array (first
iteration, value would equal '127.0.0.1', second, value would equal 11211,
etc.)

Then, you use array notation to access the first position of $value.  In the
first iteration of the foreach, $value would equal '127.0.0.1', so $value[0]
would give you '1', $value[1] would give you '2', etc.

Do you see what I'm saying? Did you forget or omit other relevant code? Or,
I'm just having a really bad code day (in this case, I'll likely see my
error just after sending this email.)

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com


Re: [PHP] Memcache problems

2011-02-03 Thread Jostein Eriksen

On 02/03/2011 10:49 PM, Adam Richardson wrote:

On Thu, Feb 3, 2011 at 4:19 PM, Jostein Eriksenphp-l...@morits.net  wrote:


Both php and memcached is running on the same server.
memcached version 1.2.2
php5-memcache version 2.2.0
php version 5.2.4

here is a snippet from my code that may be of interest
$cfg['serverList'] = array('127.0.0.1', 11211, 1, 1);
...
$this-memcache = new Memcache();
foreach($cfg['serverList'] as $value){
/** host, port, persistent, weight, timeout,
retry interval, status, failure callback */
$this-memcache-addServer($value[0],
$value[1], false, $value[2], $value[3], 2, true, array($this, 'fail'));
}



Are you sure you copied this correctly?

In the code above, you set the array key 'serverList' to an array containing
('127.0.0.1', 11211, 1, 1);

Then, you foreach through the values of the 'serverList' array (first
iteration, value would equal '127.0.0.1', second, value would equal 11211,
etc.)

Then, you use array notation to access the first position of $value.  In the
first iteration of the foreach, $value would equal '127.0.0.1', so $value[0]
would give you '1', $value[1] would give you '2', etc.

Do you see what I'm saying? Did you forget or omit other relevant code? Or,
I'm just having a really bad code day (in this case, I'll likely see my
error just after sending this email.)

Adam



My bad.

it should be:
'serverList' = array(
/** host, port, weight, timeout */
'default' = array('127.0.0.1', 11211, 
1, 1),
)),

Didn't copy/paste the $cfg = line, so it got messed up.

/Jostein

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Memcache problems

2011-02-03 Thread Alex Nikitin
Short of some process going crazy, which you should check for, some psing,
top and netstat, i cant think of any reason you should ever get a connection
drop, short of a hardware failure (memory perhaps), or an experimental
kernel settings or modules or something... i cant think of any way that a
connection to 127.0.0.1 would ever possibly get dropped, loopback device
never hits your network hardware...

~Alex

On Thu, Feb 3, 2011 at 5:00 PM, Jostein Eriksen php-l...@morits.net wrote:

 On 02/03/2011 10:49 PM, Adam Richardson wrote:

 On Thu, Feb 3, 2011 at 4:19 PM, Jostein Eriksenphp-l...@morits.net
  wrote:

  Both php and memcached is running on the same server.
 memcached version 1.2.2
 php5-memcache version 2.2.0
 php version 5.2.4

 here is a snippet from my code that may be of interest
 $cfg['serverList'] = array('127.0.0.1', 11211, 1, 1);
 ...
 $this-memcache = new Memcache();
 foreach($cfg['serverList'] as $value){
/** host, port, persistent, weight,
 timeout,
 retry interval, status, failure callback */
$this-memcache-addServer($value[0],
 $value[1], false, $value[2], $value[3], 2, true, array($this, 'fail'));
}


  Are you sure you copied this correctly?

 In the code above, you set the array key 'serverList' to an array
 containing
 ('127.0.0.1', 11211, 1, 1);

 Then, you foreach through the values of the 'serverList' array (first
 iteration, value would equal '127.0.0.1', second, value would equal 11211,
 etc.)

 Then, you use array notation to access the first position of $value.  In
 the
 first iteration of the foreach, $value would equal '127.0.0.1', so
 $value[0]
 would give you '1', $value[1] would give you '2', etc.

 Do you see what I'm saying? Did you forget or omit other relevant code?
 Or,
 I'm just having a really bad code day (in this case, I'll likely see my
 error just after sending this email.)

 Adam


 My bad.

 it should be:
 'serverList' = array(
/** host, port, weight, timeout */
'default' = array('127.0.0.1',
 11211, 1, 1),
)),

 Didn't copy/paste the $cfg = line, so it got messed up.

 /Jostein

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php