Hi all,

I'd like to request some help as to where I'm going wrong with my Authcache setup. I've got Cache Router up and running with Memcached, and Authcache is set up and configured.

From what I can tell, no pages are getting cached. The info from Authcache Debug looks similar for all page visits, with "First_Page_Request" showing for cache_render, regardless of how many times I load the page. As well, I'm not seeing any cache files being created in the filecache directory on the server.

Authcache Debug

Authcache.info
page_render: "3687.76 ms"
page_queries: "195 queries @ 56.7 ms (2%)"
cache_render: "First_Page_Request"
cache_uid: "4"
cache_inc: "cacherouter.inc (memcached)"
cache_time: 1272348924
(page_age): "-3 seconds"

My settings.php config looks like this:

$conf['cache_inc'] = './sites/all/modules/authcache/authcache.inc';
$conf['cacherouter'] = array(
'default' => array(
'engine' => 'memcached',
'servers' => array('localhost:11211'),
'shared' => TRUE,
'prefix' => '',
'path' => 'files/filecache',
'static' => FALSE,
'fast_cache' => TRUE,
),
);

I've changed/moved the filecache directory location from the default to see if that made a difference, but cache files are still not being created.

Has anyone else had this problem or can anyone offer some suggestions on what I could try next?

Cheers

Comments

TC44’s picture

Category: feature » support

edit - (changed to support request)

TC44’s picture

Version: 6.x-6.x-dev » 6.x-1.0-rc2

(Version 6.x-1.0-rc2)

Jonah Ellison’s picture

Does the page_render time change on each load? (There's a strange cookie error some people experience... if the cache cookie doesn't get set, then it always says First_Page_Request).

Also, do other caching methods work, such as using the Memcache module or caching with the database?

TC44’s picture

Hi Jonah,

Thanks very much for the reply.

I just went back to check, and the page render time does change on each load.

This time though, I did get a message in Authcache Debug the first time which I hadn't noticed before. It said something like, "this is your first page visit, debug cookie has been set".

I have not tried the memcache module, as I wanted to keep things simple and stick with cacherouter to start. I do have boost installed also for anonymous users, and it's working great, very fast.

I should point out that I'm not testing as user 1, since I don't think authcache caches user 1.

When you say caching with the database, are you referring to drupal's built in caching?

Jonah Ellison’s picture

Try changing the engine from 'memcached' to 'memcache' (memcached is an experimental alpha version).

If you comment out the "cacherouter" settings array, then Authcache will fallback to the database for caching. If it can't use the database, then something else is up.

TC44’s picture

Hi Jonah,

Here's the error I'm getting in Authcache Debug after changing the engine to memcache:

Authcache prevented caching
NO_CACHE: "Page not cached."
INFO: {"Reason":"PHP Error","type":2048,"message":"Assigning the return value of new by reference is deprecated","file":"/home/myaccount/public_html/sites/all/modules/cacherouter/engines/memcache.php","line":203}

I had my hosting company install memecached, I didn't do it myself, so I'm not exactly sure what the problem is.

This is the info for the server from phpinfo.php

memcache
memcache support enabled
Active persistent connections 0
Version 2.2.5
Revision $Revision: 1.111 $

Directive Local Value Master Value
memcache.allow_failover 1 1
memcache.chunk_size 8192 8192
memcache.default_port 11211 11211
memcache.default_timeout_ms 1000 1000
memcache.hash_function crc32 crc32
memcache.hash_strategy standard standard
memcache.max_failover_attempts 20 20

memcached
memcached support enabled
Version 1.0.1
libmemcached version 0.32
Session support yes
igbinary support no

Thanks again for helping me troubleshoot this!

TC44’s picture

Does anyone have any suggestions as to what else to check?

Thanks!

TC44’s picture

I still haven't been able to make any progress on this. My webhost did test the installation recently for me, and provided the response below:

---

The memcache installl is working correctly, the issue seems to be with your settings.php file. I was able to test that memcache was working by using telnet to port 11211 and below shows output for the following command. You may need to add this to your settings.php file.

/home/myaccount/public_html/sites/all/modules/memcache/memcache.db.inc

memcached -u root -vv
slab class 1: chunk size 80 perslab 13107
slab class 2: chunk size 104 perslab 10082
slab class 3: chunk size 136 perslab 7710
slab class 4: chunk size 176 perslab 5957
slab class 5: chunk size 224 perslab 4681
slab class 6: chunk size 280 perslab 3744
slab class 7: chunk size 352 perslab 2978
slab class 8: chunk size 440 perslab 2383
slab class 9: chunk size 552 perslab 1899
slab class 10: chunk size 696 perslab 1506
slab class 11: chunk size 872 perslab 1202
slab class 12: chunk size 1096 perslab 956
slab class 13: chunk size 1376 perslab 762
slab class 14: chunk size 1720 perslab 609
slab class 15: chunk size 2152 perslab 487
slab class 16: chunk size 2696 perslab 388
slab class 17: chunk size 3376 perslab 310
slab class 18: chunk size 4224 perslab 248
-----

TC44’s picture

changing the engine to "db" seems to yield the same results.

To test, I've set the settings.php to this:

$conf['cache_inc'] = './sites/all/modules/authcache/authcache.inc';
$conf['cacherouter'] = array(
'default' => array(
'engine' => 'db',
'servers' => array(),
'shared' => FALSE,
'prefix' => '',
'path' => 'tmp/filecache',
'static' => FALSE,
'fast_cache' => TRUE,
),
);

And still get this in authcache debug:

page_render: "5491.92 ms"
page_queries: "6557 queries @ 1633.29 ms (30%)"
cache_render: "First_Page_Request"
cache_uid: "4"
cache_inc: "cacherouter.inc (db)"
cache_time: 1273942206
(page_age): "0 seconds"

TC44’s picture

any suggestions on what to try next are appreciated :)

Jonah Ellison’s picture

You can try to comment out $conf['cacherouter'] to see if it works with the Drupal core database (Authcache falls back to this if no cache handler is configured).

If that doesn't work, then you should try disabling modules until it does. There could be a conflict. You could also try a fresh test install of Drupal with minimal modules.

TC44’s picture

Hi Jonah,

Thanks again for the help. I've commented out $conf['cacherouter'], and seem to be getting much the same result, except cache_inc now shows "database".

Authcache.info
page_render: "4740.47 ms"
page_queries: "6373 queries @ 1265.43 ms (27%)"
cache_render: "First_Page_Request" (shows this every visit)
cache_uid: "4"
cache_inc: "database"
cache_time: 1275348562
(page_age): "-1 seconds"

I guess the next step might be a clean installation as per your suggestion in a subdirectory and see what results I get from that.

sureiwin’s picture

do you have any webauth module or external_login?
some modules not compatable with authcache by disable set some cookie values to browser.
authcache depends on cookie

check your cookie value is "drupal_user" been set?

TC44’s picture

Actually now that you bring that up, I do have amember pro installed, which does intercept the login system. I'm going to disable it and report back..

TC44’s picture

sureiwin, Wow, ok. So in testing without amember pro, all now appears to be caching (using db as the engine, I haven't switched it back yet t memcached).

Sorry I didn't mention amember before, obviously that would have been helpful, it just didn't occur to me that it could be the problem.

Any suggestions on what I should do next to troubleshoot? I'm guessing I should contact amember and see what cookie values might be getting disabled?

Thanks!

TC44’s picture

Hmm. I spoke too soon. Testing again with direct login and changing the engine back to memcache or memcached, everything just hangs. If I change it to db, the site now works again but I'm getting the same cache_render: "First_Page_Request" message in Authcache Debug. This is now a regression from where I was at on June 13, where with db as engine, I was getting things working.

Now I just don't see that any cache files are getting written to files/filecache, which is what the path is currently set to.

Very strange..

Jonah Ellison’s picture

Is your memcached daemon running and configured correctly? If the site hangs, it usually a sign that PHP can't establish a connection to memcached.

TC44’s picture

Hi Jonah,

Thanks for taking the time to respond, I really do appreciate it.

Forgive my ignorance, but how would I check that? My host mentioned adding additional data to my settings.php file (#8), but I'm not quite clear on that.

Jonah Ellison’s picture

From your server's command prompt, type telnet localhost 11211 (this assumes memcached is on the same box and using the default port).

You can also upload a "Test Install" script to your server:

http://us4.php.net/manual/en/memcache.installation.php#85770

TC44’s picture

Hi Jonah,

Thanks again, here's what I'm getting. It would be on the same box, and from post #8, they did tell me it was 11211, so I'm assuming there's possibly a problem with memcached on the server?

[root@server /]# telnet localhost 11211
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host: Connection refused
[root@server /]#

TC44’s picture

I also ran the memcached_test.php file, and I guess here's my answer.

Warning: Memcache::connect() [memcache.connect]: Can't connect to localhost:11211, Connection refused (111) in /home/myaccount/public_html/memcached_test.php on line 3
Could not connect

TC44’s picture

My host has got memcached up and running for me again.

Now, when I set authcache to "memcache" in settings.php, I get the following message in authcache debug:

Authcache prevented caching
NO_CACHE: "Page not cached."
INFO: {"Reason":"PHP Error","type":2048,"message":"Assigning the return value of new by reference is deprecated","file":"/home/mysite/public_html/sites/all/modules/cacherouter/engines/memcache.php","line":199}

If I set it to "memcached", I get errors on the page:

Warning: Memcached::set() expects at most 3 parameters, 4 given in /home/mysite/public_html/sites/all/modules/cacherouter/engines/memcached.php on line 90

Warning: Memcached::set() expects at most 3 parameters, 4 given in /home/mysite/public_html/sites/all/modules/cacherouter/engines/memcached.php on line 101

Warning: Cannot modify header information - headers already sent by (output started at /home/mysite/public_html/sites/all/modules/cacherouter/engines/memcached.php:90) in /home/venusund/public_html/includes/bootstrap.inc on line 636

etc...

I'm running the lastest 6.x-1.0-rc2 of authcache, and updated cacherouter to the May 25 6.x-1.x-dev. Error message is the same after the update.

Could this now be a compatibility issue with the version of memcache or memcached installed on the server?

"Assigning the return value of new by reference is deprecated","file":"/home/mysite/public_html/sites/all/modules/cacherouter/engines/memcache.php","line":199

Has anyone else seen that error message in authcache debug?

Jonah Ellison’s picture

You're probably running PHP 5.3 (several modules have give reference errors due to PHP 5.3 changes). You'll need to modify memcache.php by replacing $this->memcache =& new Memcache; with $this->memcache = new Memcache;

TC44’s picture

Hi Jonah,

Thanks very much for the quick reply! That did indeed get rid of those errors.

I'm now almost back at square one however. Even when logging in directly, nothing seems to be caching, either with memcache, memcached, or db as the engine, despite visiting the page multimple times with each.

with memcache:

page_render: "5478.4 ms"
page_queries: "6371 queries @ 1083.43 ms (20%)"
cache_render: "First_Page_Request"
cache_uid: "4"
cache_inc: "cacherouter.inc (memcache)"
cache_time: 1277830386
(page_age): "0 seconds"

with memcached:

page_render: "5349.59 ms"
page_queries: "6370 queries @ 1080.87 ms (20%)"
cache_render: "First_Page_Request"
cache_uid: "4"
cache_inc: "cacherouter.inc (memcached)"
cache_time: 1277830849
(page_age): "0 seconds"

with db:

page_render: "5067.8 ms"
page_queries: "6562 queries @ 1416.02 ms (28%)"
cache_render: "First_Page_Request"
cache_uid: "4"
cache_inc: "cacherouter.inc (db)"
cache_time: 1277831741
(page_age): "0 seconds"

Here's what my settings.php file looks like:

/* $conf['cache_inc'] = './sites/all/modules/cacherouter/cacherouter.inc'; */
$conf['cache_inc'] = './sites/all/modules/authcache/authcache.inc';
$conf['cacherouter'] = array(
'default' => array(
'engine' => 'memcached',
'servers' => array('localhost:11211'),
'shared' => TRUE,
'prefix' => '',
'path' => './files/filecache',
'static' => FALSE,
'fast_cache' => TRUE,
),
);

I just don't know what else to try. The cache path appears to be correct, and I've set write permissions and tried different paths as well, but no cache files appear to be getting created..

Jonah Ellison’s picture

Is the 'page_render' value different on each refresh? If it's the same, then it is caching and there could be a cookie issue.

Otherwise, try disabling modules until it works. There could be a conflict that is preventing the page from caching.

It is really difficult for me to debug this type of issue, since I would need to somehow reproduce it on my own, which I can't.

TC44’s picture

Hi Jonah,

Page render is different on each refresh. I'll start disabling things and see if there's any difference.

Thanks again!

TC44’s picture

Hi Jonah,

You are right, it's a conflict. Not sure which module yet as I disabled a bunch at a time, but I've got it narrowed down. I'm going to do some more testing to find out exactly which one.

Thanks!!

TC44’s picture

I've narrowed it down to:

OG Content Type Admin 6.x-1.0 (I'll do an update and see if it's still a problem with the newest version).

Also, logging in to the site through amember pro also conflicts, so those are the two issues I'll need to resolve.

Thanks for all your help Jonah and sureiwin! I really appreciate it!

TC44’s picture

Updating OG Content Type admin to the dev version has solved that problem.

So I just need to contact the amember pro people.

In reference to what sureiwin has posted in #13, I guess I need to find out what drupal cookie values amember might be disabling? Would that be correct?

Jonah Ellison’s picture

Authcache implements hook_user() to create/delete cookie values when a user logs in/out, so make sure that hook is being called (you can try to put some code in under "login" to test with amember). The cache cookies are "authcache", "drupal_user" and "drupal_uid"

znerol’s picture

Issue summary: View changes
Status: Active » Closed (outdated)