I am working on a Drupal 5.12 site. Recently, apparently for no reason, meaning no known cause, anonymous users began seeing empty pages--no HTML content was being delivered to their browsers whatsoever. Logged in users were fine. I eventually determined that if I turn off the cache, then anonymous users are fine.

The cache that I disabled was of the Normal variety, not Aggressive. The problem remains, however, that if the cache is enabled, anonymous users get the WSOD. After I was able to get the site working for anonymous users, I began to debug what exactly the problem could be. I tried clearing the cache using the devel module and I also tried clearing it directly in MySQL:

truncate cache;
truncate cache_content;
truncate cache_filter;
truncate cache_menu;
truncate cache_page;
truncate cache_views;

After clearing the cache (via any method) the first page request I do as an anon user works, but the second fails--I get WSOD.

I then ran this test, as simple PHP code in a page I made, to see if the cache is working:

cache_set('test', 'cache', 'my testing data');
print_r(cache_get('test', 'cache'));

and the results appear to indicate that it works fine:

stdClass Object
(
    [data] => my testing data
    [created] => 1227622264
    [headers] => 
    [expire] => 0
)

So I thought to examine what's being cached exactly. I cleared the cache and then checked to make sure from the MySQL CLI:

mysql> select cid,created from cache;
Empty set (0.00 sec)

Looks clear. Then I requested a page as anon user (with caching disabled BTW) and then I saw this:

mysql> select cid,created from cache;
+-----------------------------------+------------+
| cid                               | created    |
+-----------------------------------+------------+
| variables                         | 1227626901 |
| imagecache:presets                | 1227626901 |
| emfield_implement_types           | 1227626903 |
| emimport_types_allowing_import    | 1227626903 |
| date_formats:field_expires_on:    | 1227626922 |
| date_formats:field_date:          | 1227626921 |
| date_formats:field_date_end:      | 1227626921 |
| date_formats:field_date_start:    | 1227626921 |
| google:docid-4523674103796100817: | 1227626902 |
| google:docid6452795720218076508:  | 1227626922 |
+-----------------------------------+------------+
10 rows in set (0.00 sec)

I then waited a few minutes and checked again:

mysql> select cid,created from cache;
+-----------------------------------+------------+
| cid                               | created    |
+-----------------------------------+------------+
| variables                         | 1227626901 |
| imagecache:presets                | 1227626901 |
| emfield_implement_types           | 1227627032 |
| emimport_types_allowing_import    | 1227627032 |
| date_formats:field_expires_on:    | 1227627029 |
| date_formats:field_date:          | 1227626921 |
| date_formats:field_date_end:      | 1227626921 |
| date_formats:field_date_start:    | 1227626921 |
| google:docid-4523674103796100817: | 1227626902 |
| google:docid6452795720218076508:  | 1227626922 |
| google:docid-8010916811852138370: | 1227626966 |
| google:docid8984424637152522592:  | 1227626966 |
+-----------------------------------+------------+
12 rows in set (0.00 sec)

I presume that there are actual visitors out there surfing to the site as anonymous users, and that explains why the cache is growing. I can guess as to why those particular entries are showing up because we have imagecache, CCK with a set of fields, events with dates, and we link to Google videos.

At this point, however, I am not sure in what direction to proceed with debugging this. The cache seems to be filling up, which is expected, and my test run at storing and retrieving data from the cache works. What it is that is not working I do not know.

Any ideas are appreciated.

Comments

ziobudda’s picture

Have you tried to see the error-log ? php and web server.
If you active the php display error log do you see something ?

M.

Freelancer Senior Drupal Developer -- http://www.ziobuddalabs.it

mcjim’s picture

Have you tried similar tests on cache_page? That's the table that's used to store the whole page for anonymous users.

Gman’s picture

Do you have the mbstring PHP extension installed on your server? You can check by going to the www.example.com/admin/logs/status page and checking the Unicode library entry towards the bottom. I once had a host that would install this extension exhibit symptoms as you describe. On page would load for a visitor, but if you refresh it, it would come up blank. But logged in members were fine. If it says the Mbstring extension is there, then it is not this issue.

----------
Drupal Blog
Dog Parks via Drupal

hershel’s picture

When the error first surfaced, I checked the Apache error log and found nothing.

I tested now

cache_set('test', 'cache_page', 'my testing data');
print_r( cache_get('test', 'cache_page'));

and it works fine.

Status log says

Unicode library	PHP Mbstring Extension

and anyway unless they changed this on the day that this problem came up, this could not be the issue, because the caching was working fine for many months.

I am still at a loss. :(

I will ask the host to enable the PHP error log; perhaps that will show something.

Thank you.

hershel’s picture

The use of drupal_add_js() in hook_init() in a custom module caused this PHP error:

 PHP Fatal error:  Call to undefined function drupal_add_js() in /var/www/vhosts/mysite.org/httpdocs/sites/all/modules/mymod/mymod.module on line 779

Now that I figured it out, I see that this issue was reported here also: http://www.ubercart.org/forum/bug_reports/651/random_fatal_error_drupal_...

The issue is noted in the docs for hook_init():

If you implement this hook and see an error like 'Call to undefined function', it is likely that you are depending on the presence of a module which has not been loaded yet. It is not loaded because Drupal is still in bootstrap mode. The usual fix is to move your code to hook_menu(!$may_cache).

After I finally got the (worthless) host to turn on the PHP error log, I found this easily.

--
Gallery Robinson
Web Development Specialists
http://galleryrobinson.com/