Memcached Server 1.4.18 and XenForo

rdn

Well-known member
Does anybody here using both the latest Memcached Server 1.4.18 and XenForo 1.3?
I'm using it since yesterday but memcached server randomly stop's or not responding.

So I just reverted to v1.4.17 for now.
 
I also got this on my php.ini
Code:
session.save_handler = memcached
session.save_path = "127.0.0.1:11211"

@MattW changed it for me.
 
No, I'm sticking with 1.4.17

1.4.17 is VERY stable, so I'll be sticking with that unless I get errors with it (which I haven't since it was released)
 
  • Like
Reactions: rdn
I'm running on 1.4.18 without issues.
Yes, there is a bug, you have to fix the mutex/stats_lock's during the crawler lock loop.
Code:
# yum --enablerepo=axivo update memcached
# yum info memcached
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centost5.centos.org
* extras: centosz3.centos.org
* updates: centost5.centos.org
Installed Packages
Name        : memcached
Arch        : x86_64
Epoch       : 1
Version     : 1.4.18
Release     : 1.el6
Size        : 166 k
Repo        : installed
From repo   : axivo
Summary     : High-performance memory object caching system
URL         : http://www.memcached.org/
License     : BSD
Description : Memcached is a high-performance, distributed memory object caching system,
            : generic in nature, but intended for use in speeding up dynamic web applications
            : by alleviating database load.

Build Tests

Patches
Code:
--- a/items.c
+++ b/items.c
@@ -764,6 +764,7 @@ static void item_crawler_evaluate(item *search, uint32_t hv, int i) {
static void *item_crawler_thread(void *arg) {
     int i;

+    pthread_mutex_lock(&lru_crawler_lock);
     if (settings.verbose > 2)
         fprintf(stderr, "Starting LRU crawler background thread\n");
     while (do_run_lru_crawler_thread) {
@@ -827,8 +828,8 @@ static void *item_crawler_thread(void *arg) {
     STATS_LOCK();
     stats.lru_crawler_running = false;
     STATS_UNLOCK();
-    pthread_mutex_unlock(&lru_crawler_lock);
     }
+    pthread_mutex_unlock(&lru_crawler_lock);
     if (settings.verbose > 2)
         fprintf(stderr, "LRU crawler thread stopping\n");

--- a/items.c
+++ b/items.c
@@ -769,9 +769,6 @@ static void *item_crawler_thread(void *arg) {
         fprintf(stderr, "Starting LRU crawler background thread\n");
     while (do_run_lru_crawler_thread) {
     pthread_cond_wait(&lru_crawler_cond, &lru_crawler_lock);
-    STATS_LOCK();
-    stats.lru_crawler_running = true;
-    STATS_UNLOCK();

     while (crawler_count) {
         item *search = NULL;
@@ -918,6 +915,9 @@ enum crawler_result_type lru_crawler_crawl(char *slabs) {
     }
     pthread_mutex_unlock(&cache_lock);
     pthread_cond_signal(&lru_crawler_cond);
+    STATS_LOCK();
+    stats.lru_crawler_running = true;
+    STATS_UNLOCK();
     pthread_mutex_unlock(&lru_crawler_lock);
     return CRAWLER_OK;
}
 
Last edited:
I'm running on 1.4.18 without issues.
Yes, there is a bug, you have to fix the mutex/stats_lock's during the crawler lock loop.
Code:
# yum --enablerepo=axivo update memcached
# yum info memcached
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centost5.centos.org
* extras: centosz3.centos.org
* updates: centost5.centos.org
Installed Packages
Name        : memcached
Arch        : x86_64
Epoch       : 1
Version     : 1.4.18
Release     : 1.el6
Size        : 166 k
Repo        : installed
From repo   : axivo
Summary     : High-performance memory object caching system
URL         : http://www.memcached.org/
License     : BSD
Description : Memcached is a high-performance, distributed memory object caching system,
            : generic in nature, but intended for use in speeding up dynamic web applications
            : by alleviating database load.

Build Tests

Patches
Code:
--- a/items.c
+++ b/items.c
@@ -764,6 +764,7 @@ static void item_crawler_evaluate(item *search, uint32_t hv, int i) {
static void *item_crawler_thread(void *arg) {
     int i;

+    pthread_mutex_lock(&lru_crawler_lock);
     if (settings.verbose > 2)
         fprintf(stderr, "Starting LRU crawler background thread\n");
     while (do_run_lru_crawler_thread) {
@@ -827,8 +828,8 @@ static void *item_crawler_thread(void *arg) {
     STATS_LOCK();
     stats.lru_crawler_running = false;
     STATS_UNLOCK();
-    pthread_mutex_unlock(&lru_crawler_lock);
     }
+    pthread_mutex_unlock(&lru_crawler_lock);
     if (settings.verbose > 2)
         fprintf(stderr, "LRU crawler thread stopping\n");

--- a/items.c
+++ b/items.c
@@ -769,9 +769,6 @@ static void *item_crawler_thread(void *arg) {
         fprintf(stderr, "Starting LRU crawler background thread\n");
     while (do_run_lru_crawler_thread) {
     pthread_cond_wait(&lru_crawler_cond, &lru_crawler_lock);
-    STATS_LOCK();
-    stats.lru_crawler_running = true;
-    STATS_UNLOCK();

     while (crawler_count) {
         item *search = NULL;
@@ -918,6 +915,9 @@ enum crawler_result_type lru_crawler_crawl(char *slabs) {
     }
     pthread_mutex_unlock(&cache_lock);
     pthread_cond_signal(&lru_crawler_cond);
+    STATS_LOCK();
+    stats.lru_crawler_running = true;
+    STATS_UNLOCK();
     pthread_mutex_unlock(&lru_crawler_lock);
     return CRAWLER_OK;
}
and
http://pecl.php.net/package/memcached
Using 2.2.0? or 2.1.0 ?
 
Code:
# yum info php-pecl-memcached
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.bhs.mirrors.ovh.net
 * extras: centos.bhs.mirrors.ovh.net
 * updates: www.cubiculestudio.com
Installed Packages
Name        : php-pecl-memcached
Arch        : x86_64
Version     : 2.2.0
Release     : 1.el6
Size        : 375 k
Repo        : installed
From repo   : axivo
Summary     : Extension for interfacing with memcached via libmemcached library
URL         : http://pecl.php.net/package/memcached
License     : PHP and MIT
Description : This extension uses libmemcached library to provide API for communicating with
            : memcached servers. Memcached is a high-performance, distributed memory object
            : caching system, generic in nature, but intended for use in speeding up dynamic
            : web applications by alleviating database load.
 
If you don't mind, Can you please share your memcached config?

Did you use this Added session handler settings?
* memcached.sess_number_of_replicas
* memcached.sess_randomize_replica_read
* memcached.sess_remove_failed
* memcached.sess_connect_timeout
 
Last edited:
@RoldanLT, I will post it as part of my "10 Minutes Setup" tutorial, soon available at AXIVO for Red Hat/CentOS 6.5 64 bits. Yes, you can set a server ready for a web aplication like XenForo in 10 minutes.

For your knowledge, those options are not new in 2.2.0 but made surface since 2.1.0 if I'm not mistaken... anyways, they are part of AXIVO rpm since 2.1.0... which reminds me to document them better into config file. :)
 
Last edited:
@RoldanLT, I will post it as part of my "10 Minutes Setup" tutorial, soon available at AXIVO for Red Hat/CentOS 6.5 64 bits. Yes, you can set a server ready for a web aplication like XenForo in 10 minutes.

For your knowledge, those options are not new in 2.2.0 but made surface since 2.1.0 if I'm not mistaken... anyways, they are part of AXIVO rpm since 2.1.0... which reminds me to document them better into config file. :)
That's great!

I think those settings are new on v2.2.0b1
http://pecl.php.net/package/memcached/2.2.0b1
 
Does anybody here using both the latest Memcached Server 1.4.18 and XenForo 1.3?
I'm using it since yesterday but memcached server randomly stop's or not responding.

So I just reverted to v1.4.17 for now.
Finally they released fix for my problem :)
https://code.google.com/p/memcached/wiki/ReleaseNotes1420

Memcached 1.4.20 Release Notes
Date: 2014-5-11

http://www.memcached.org/files/memcached-1.4.20.tar.gz

Overview

Just one tiny change to fix a regression causing threads to lock up and spin max CPU.

1.4.18 and 1.4.19 were affected. 1.4.17 and earlier were not affected. If you are on .18 or .19 an upgrade to 1.4.20 is strongly advised.

Thanks to commando.io for reporting the bug initially and putting up with me being blind for a few weeks.

Fixes

  • Fix a race condition causing new connections to appear closed, causing an inifinte loop.
 
@RoldanLT - have you run into any issues since going to memcached 1.4.20?

I had the same issue with 1.4.15 last year and ended up rolling back to 1.2.8 because I didn't have time to deal with disappearing memcached daemons (was happening about once every 24-48 hours for me). I finally broke down and ugpradeed to 1.4.20 last night and so far it hasn't died, but just wondering how closely I should be watching it. :)
 
I have a small VPS, with 512MB Ram + 512mb as vSwap, so 1 GB Ram. Is it worth to install memcached on this VPS?
 
Back
Top Bottom