[horde] Problem with XCache and Horde

Jens Grüntjes jens.gruentjes at ebira.de
Tue Apr 28 13:53:48 UTC 2015


Zitat von Michael J Rubinsky <mrubinsk at horde.org>:

> Quoting Jens Grüntjes <jens.gruentjes at ebira.de>:
>
>> Hello,
>>
>> since I changed the PHP opcode cache from APC to XCache I'm running  
>> into problems with horde. Whenever horde-alarms is executed I  
>> receive an error message like:
>>
>> Cannot write Autoloader cache to backend
>>
>> Horde's log file then contains the following line:
>>
>> 2015-04-28T10:50:03+00:00 WARN: HORDE [horde] PHP ERROR:  
>> xcache_set(): XCache var cache was not initialized properly. Check  
>> php log for actual reason [pid 2603 on line 155 of  
>> "/usr/share/php/Horde/Autoloader/Cache/Bootstrap.php"]
>>
>> I can raise the error if I manually execute horde-alarms as well.
>>
>> As I wrote in a previous post to the imp-list (subject was: [imp]  
>> Cannot write Autoloader cache to backend.), I tried/checked  
>> different things to find out what the reason is.
>>
>> 1) The directory /tmp is writable for the webserver
>>
>> 2) XCache is activated according to the output of phpinfo() and to  
>> the XCache admin page of my server
>>
>> 3) I tried to use XCache from inside horde, i.e. the PHP console:
>>
>> $test = "Hello";
>> xcache_set("test", $test);
>>
>> I see the variable test in XCache's admin-view with the value  
>> Hello. So it looks as if XCache is working from inside horde.
>>
>> 4) I tried using xcache from inside a website rather than from  
>> horde's console, and that works.
>>
>> 5) I put a log statement in  
>> /usr/share/php/Horde/Autoloader/Cache/Bootstrap.php like this:
>>
>> public function set($key, $data)
>>    {
>>        $data = ($this->_mask & self::MSGPACK)
>>            ? msgpack_pack($data)
>>            : json_encode($data);
>>
>>        if ($this->_mask & self::LZ4) {
>>            $data = @horde_lz4_compress($data);
>>        } elseif ($this->_mask & self::LZF) {
>>            $data = lzf_compress($data);
>>        }
>>
>>        if ($this->_mask & self::APC) {
>>            return apc_store($key, $data);
>>        } elseif ($this->_mask & self::XCACHE) {
>>            error_log($key, 4);  // <---- Logging here
>>            error_log($data, 4); // <---- Logging here
>>            return xcache_set($key, $data);
>>        }
>> ...
>> }
>>
>> When I run horde-alarms from command line the message is triggered.  
>> I copied the output into a simple php-script:
>
> My guess is that you have a different php.ini file for PHP CLI than  
> for cgi/apache_mod and you haven't configured xcache.var_size  
> properly in that file.
>
I'm using a Debian system and there are different php.ini files for  
cgi an cli. AFAIK these files kind of "source" the the contents of a  
directory conf.d/ which contains an ini-file for xcache. I copied the  
(hopefully) relevant parts:

; select low level shm/allocator scheme implemenation
xcache.shm_scheme =        "mmap"
; to disable: xcache.size=0
; to enable : xcache.size=64M etc (any size > 0) and your system mmap allows
xcache.size  =                64M
; set to cpu count (cat /proc/cpuinfo |grep -c processor)
xcache.count =                 2
; just a hash hints, you can always store count(items) > slots
xcache.slots =                8K
; ttl of the cache item, 0=forever
xcache.ttl   =                 0
; interval of gc scanning expired items, 0=no scan, other values is in seconds
xcache.gc_interval =           0

; same as aboves but for variable cache
xcache.var_size  =           32M
xcache.var_count =             2
xcache.var_slots =            8K
; default ttl
xcache.var_ttl   =             0
xcache.var_maxttl   =          0
xcache.var_gc_interval =     300

xcache.test =                Off
; N/A for /dev/zero
xcache.readonly_protection = Off
; for *nix, xcache.mmap_path is a file path, not directory.
; Use something like "/tmp/xcache" if you want to turn on ReadonlyProtection
; 2 group of php won't share the same /tmp/xcache
; for win32, xcache.mmap_path=anonymous map name, not file path
; xcache.mmap_path =    "/dev/zero"
xcache.mmap_path =    "/tmp/xcache"

The file /tmp/xcache exists and its size is xcache.size + xcache.var_size

Do you think that this is too small? On the XCache admin page I can  
see that the opcode cache is about 50% used but the var cache below 1%.

--
Greetings
Jens



More information about the horde mailing list