joomla + memcached = some session problems

Discussion regarding Joomla! 1.5 Performance issues.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Security and Performance FAQs
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
serjs
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Wed Nov 25, 2009 10:02 am

joomla + memcached = some session problems

Post by serjs » Sat Dec 19, 2009 1:32 pm

Hi i have some troubles with memcached + joomla. I installed and started memcached => joomla options cache type memcache (write memcache options) and session type - memcache too. Save all options and after cann't login to site and administration. In error log nothing, when i change cache to database i can login, where is the problem?

User avatar
joomfriend
Joomla! Explorer
Joomla! Explorer
Posts: 284
Joined: Sun Feb 08, 2009 5:10 pm
Contact:

Re: joomla + memcached = some session problems

Post by joomfriend » Thu Jan 07, 2010 5:40 am

Hello serjs,

Check that memcache is installed properly. Installing and setting memcached is a little bit tricky. Yes! memcached MUST be properly configured otherwise your site won't respond well. I suggest you contact your host and let them install and set memcached for you.
- https://www.adelnipet.com: Adelni Pet - Your Social Pet Network
- https://www.egliseprimitive.org: Christian Website

User avatar
vipinsahu
Joomla! Explorer
Joomla! Explorer
Posts: 311
Joined: Fri Dec 18, 2009 9:23 am
Location: India
Contact:

Re: joomla + memcached = some session problems

Post by vipinsahu » Thu Jan 07, 2010 9:48 am

hey i think u haven't check the session time ?
Vipin sahu
PHP/Joomla, Social Media , Magento Developer
http://webkul.com
http://voipkul.com/

serjs
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Wed Nov 25, 2009 10:02 am

Re: joomla + memcached = some session problems

Post by serjs » Wed Feb 03, 2010 11:25 pm

Where i must config memcached? I install it, set some options on my rc.d script
command_args="-d -u ${memcached_user} -l myip -L"
In joomla:
Cache Settings
Cache Handler MemoryCache
Persistent Memory Cache Yes
Memory Cache Server myip and port
netstat -a | grep 11211 say memcached worker
echo stats | nc 127.0.0.1 11211 give me some stat

Session Settings
When i set Memory Cached for session, i logoff and after i can't logon.

@vipinsahu, my session time = 30 min as default

serjs
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Wed Nov 25, 2009 10:02 am

Re: joomla + memcached = some session problems

Post by serjs » Mon Feb 22, 2010 7:52 am

UPD
When i set error layout for max, i hove some warn's on my log file.

Code: Select all

Notice: MemcachePool::delete() [memcachepool.delete]: Server 127.0.0.1 (tcp 11211, udp 0) failed with: CLIENT_ERROR bad command line format. Usage: delete <key> [noreply] (0) in /home/site/data/www/example.org/libraries/joomla/session/storage/memcache.php on line 209

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/site/data/www/example.org/libraries/joomla/session/storage/memcache.php:209) in /home/site/data/www/example.org/libraries/joomla/session/session.php on line 423

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/site/data/www/example.org/libraries/joomla/session/storage/memcache.php:209) in /home/site/data/www/example.org/libraries/joomla/session/session.php on line 423

Warning: Cannot modify header information - headers already sent by (output started at /home/site/data/example.org/libraries/joomla/session/storage/memcache.php:209) in /home/site/data/www/example.org/libraries/joomla/session/session.php on line 426

User avatar
bmkdigital
Joomla! Intern
Joomla! Intern
Posts: 70
Joined: Tue Feb 16, 2010 8:14 am
Location: UK
Contact:

Re: joomla + memcached = some session problems

Post by bmkdigital » Mon Feb 22, 2010 8:15 am

Looks like joomla is having problems using memcached that is then generating a error that is getting out put before the headers.

I'd say you cannot login as it cannot save the session data.
http://www.bmkdigital.co.uk bmk Digital - Joomla installs, updates, maintenance and optimization
Signature rules - Literal URLs Only.

serjs
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Wed Nov 25, 2009 10:02 am

Re: joomla + memcached = some session problems

Post by serjs » Mon Feb 22, 2010 8:32 am

And whereis the problem? I wrote some example to work with the sessions with mecache and there everything works. In the case of the joomla session does not work. Not sure what the problem with memcache or its configuration.

User avatar
bmkdigital
Joomla! Intern
Joomla! Intern
Posts: 70
Joined: Tue Feb 16, 2010 8:14 am
Location: UK
Contact:

Re: joomla + memcached = some session problems

Post by bmkdigital » Mon Feb 22, 2010 8:55 am

Without seeing some more log I'm not sure, the first line gives some clues as memcached is getting told to delete but does not seem to like how it was asked and suggests it's a client error. If I did not have anything else to go on I would guess at some sort of miss match between the version joomla was written for and the version you have installed.
http://www.bmkdigital.co.uk bmk Digital - Joomla installs, updates, maintenance and optimization
Signature rules - Literal URLs Only.

serjs
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Wed Nov 25, 2009 10:02 am

Re: joomla + memcached = some session problems

Post by serjs » Mon Feb 22, 2010 9:04 am

There is no more error, notice or warn messages on my log file. I have latest joomla on my server and memcached-1.4.4 + PECL/memcache-3.0.4

WillSpencer
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Thu Feb 26, 2009 9:49 am

Re: joomla + memcached = some session problems

Post by WillSpencer » Fri Apr 16, 2010 12:40 am

serjs wrote:Hi i have some troubles with memcached + joomla. I installed and started memcached => joomla options cache type memcache (write memcache options) and session type - memcache too. Save all options and after cann't login to site and administration. In error log nothing, when i change cache to database i can login, where is the problem?
I am seeing the same thing on my Joomla site. I have to edit configuration.php manually before I can log back into my site.

This same thing happens when I try to use APC as the session manager in Joomla.

Both APC and Memcache are configured and working properly on my server -- but Joomla is not working correctly with either.

This looks like a bug to me.

turnkeye
Joomla! Intern
Joomla! Intern
Posts: 78
Joined: Tue Sep 22, 2009 1:03 pm
Contact:

Re: joomla + memcached = some session problems

Post by turnkeye » Fri Apr 16, 2010 6:40 pm

It is bug of memcache, install the latest version.

http://code.google.com/p/memcached/wiki/ReleaseNotes144

----------------------------------------------------------------
Fixes

Add partial backwards compatibility for delete with timeout 0
Before version 1.4.0, there was an optional argument to delete that would allow a client to specify that a deleted object should exist in the cache after the deletion occurred such that add operations would fail even though objects did not appear in the cache.

This feature was removed completely in 1.4.0, but a parser bug caused it to slip through. The bug was fixed in 1.4.3. If anyone was attempting to use it legitimately in the 1.4 series, it would simply not work as expected.

The 1.4.4 backwards compatibility change allows specifically the value of 0 (i.e. non-lingering delete), while continuing to reject others. This will satisfy clients that always wish to send a value even when they do not wish the item to linger.
http://TurnkeyE.com - Web-design, Custom Development, Outsourcing services for Joomla!™

WillSpencer
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Thu Feb 26, 2009 9:49 am

Re: joomla + memcached = some session problems

Post by WillSpencer » Fri Apr 16, 2010 7:36 pm

The current version supported by Ubuntu is memcached 1.2.8.

turnkeye
Joomla! Intern
Joomla! Intern
Posts: 78
Joined: Tue Sep 22, 2009 1:03 pm
Contact:

Re: joomla + memcached = some session problems

Post by turnkeye » Fri Apr 16, 2010 7:43 pm

WillSpencer wrote:The current version supported by Ubuntu is memcached 1.2.8.
I sure it is possible to find Debian package of Memecache 1.4 and install it to Ubuntu.
Ubuntu is Debian based OS.
http://TurnkeyE.com - Web-design, Custom Development, Outsourcing services for Joomla!™

binhle410
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Mar 24, 2010 10:08 am
Contact:

Re: joomla + memcached = some session problems

Post by binhle410 » Fri Jun 25, 2010 2:29 am

Try setting you session cache is database and NOT memcache
It should work.
free Joomla Tutorials for everyone http://joomla101.org (ver 1.6.x) joomla tutorials
Let's help spread the word of Joomla. I love it.

freeze1992
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Dec 17, 2010 10:51 am

Re: joomla + memcached = some session problems

Post by freeze1992 » Fri Dec 17, 2010 10:54 am

binhle410 wrote:Try setting you session cache is database and NOT memcache
It should work.
yea i get that but how am i able to do that if i can't login to the administrator anymore?
i already tried to find it in all the storage .php files but i couldn't find it there

WillSpencer
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Thu Feb 26, 2009 9:49 am

Re: joomla + memcached = some session problems

Post by WillSpencer » Fri Dec 17, 2010 11:10 am

freeze1992 wrote:
binhle410 wrote:Try setting you session cache is database and NOT memcache
It should work.
yea i get that but how am i able to do that if i can't login to the administrator anymore?
i already tried to find it in all the storage .php files but i couldn't find it there
Edit your configuration.php file:

Code: Select all

var $cache_handler = 'file';

freeze1992
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Dec 17, 2010 10:51 am

Re: joomla + memcached = some session problems

Post by freeze1992 » Fri Dec 17, 2010 11:25 am

WillSpencer wrote:
freeze1992 wrote:
binhle410 wrote:Try setting you session cache is database and NOT memcache
It should work.
yea i get that but how am i able to do that if i can't login to the administrator anymore?
i already tried to find it in all the storage .php files but i couldn't find it there
Edit your configuration.php file:

Code: Select all

var $cache_handler = 'file';
its exact the same in my file

Entry66
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sun Mar 20, 2011 1:53 pm

Re: joomla + memcached = some session problems

Post by Entry66 » Sun Mar 20, 2011 1:58 pm

I had the same problem and solved it by editing configuration file with the following setting

var $session_handler = 'database';

JonathanJW
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Sep 16, 2011 2:03 am

Re: joomla + memcached = some session problems

Post by JonathanJW » Fri Sep 16, 2011 2:37 am

It is best to ask your hosting service to reinstall memcached and joomla and that may solve the problem.

1h_hackman
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Thu Jun 28, 2012 10:39 pm

Re: joomla + memcached = some session problems

Post by 1h_hackman » Thu Jun 28, 2012 10:43 pm

In order to make Joomla to use memcache for session caching you need to manually edit the configuration.php and change the $session_handler from 'database' to 'memcache'

And here is what is missing everywhere, you need to add a new option memcache_settings:

Code: Select all

public $memcache_settings = 'a:3:{s:10:"persistent";s:1:"0";s:11:"compression";s:1:"0";s:7:"servers";a:1:{i:0;a:2:{s:4:"host";s:9:"127.0.0.1";s:4:"port";s:5:"11211";}}}';
This is a serialized multy-dimentianal array. I use this code to generate the above string:

Code: Select all

 $a = array(
   "persistent" => "0", 
   "compression" => "0", 
   "servers" => array(
     "0" => array(
       "host" => "127.0.0.1", "port" => "11211")
     )
   );

echo(serialize($a));
If you don't add the memcache_settings option your sessions will never work with memcache.

strudel
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Wed May 16, 2012 4:41 pm

Re: joomla + memcached = some session problems

Post by strudel » Thu Oct 29, 2015 6:05 pm

Some Joomla sites just might not work well or at all with memcache, particularly sites with third-party add-ons. See:

https://www.cloudaccess.net/about-us/bl ... -site.html


Locked

Return to “Performance - Joomla! 1.5”