4

There is a very strange bug that is happening on one of our client websites, and we have been unable to figure out what's going on. It's a tough one.

The Issue


In simple terms, Drupal is loading the wrong JavaScript file. We have a custom theme for the site. In the theme's .info file there is this line:

scripts[] = script/script.js

A couple of weeks ago we updated the .info file. The original .info file contained:

scripts[] = script/script-min.js

The script and script-min files are completely different files, and the server should be loading the script.js file.

Here is the behavior we are witnessing:

  • When we flush theme cache, Drupal reads in the .info file and loads script.js
  • After cron runs (every 5 minutes) Drupal will randomally decide to load script-min.js
  • If we check the database, the system table shows that Drupal has cached script-min.js

It should be noted that nothing in the code is loading script-min.js. We have grepped through and cannot find where Drupal would even be trying to load the file from. The script-min.js file exists in the script directory along-side the script.js file, but nowhere is it referenced.

Our Setup


  • Acquia Cloud Hosting w/ Git and PHP 5.3+
  • 3 environments (dev, stage, production)
  • Production environment has two web servers, a balancer, varnish and MySQL. Web servers use Gluster file system to sync files
  • This issue does not appear to show up on our dev/stage servers

What we've tried


None of these fixes worked:

  • Rebuilding registry
  • Removing script-min.js file
  • Targeting web server IPs to rule out an issue with the dual-server setup
  • Clearing all caches
  • Clearing Varnish cache

Why we need help


We have been trying to diagnose this issue for nearly two weeks now, and we've run out of the obvious ideas. Our main theory right now is that their might be an issue with the two web servers, but from all of our testing, it doesn't appear to be the case... But does make the most sense.

We are aware that we could probably get the server to use the right JS file by just using drupal_add_js instead of the .info method, but we really want to know why the server is loading a file that we are not telling it to.

EDITS


These modules implement hook_cron() on the site: acquia_agent, acquia_spi, ctools, dblog, field, googleanalytics, node, scheduler, system, update, xmlsitemap_node, xmlsitemap, xmlsitemap_engines

I have already checked, and during cron, the drupal_clear_js_cache, system_rebuild_theme_data, and drupal_theme_rebuild functions are not hit. My original assumptions had to do with those functions, but if they are not running during cron, they are probably not the issue.

We think the issue might be related to this bug report: http://drupal.org/node/1765812

  • after cron run is only script-min.js loaded or both scripts? – Petro Popelyshko Dec 19 '12 at 16:50
  • After cron, Drupal loads only the script-min.js file. And I should mention that the server seems like it is loading an old .info file, as it is not loading another javascript file that was added to the new .info file. The weird part, is there is NO old .info file on the server, at all... – donutdan4114 Dec 19 '12 at 17:38
  • Sounds like something is wrong with your GlusterFS. – mpdonadio Dec 19 '12 at 18:05
  • We thought it might be a GFS issue, but we don't know too much about it, or what might be going on. We've run tests to make sure the files are syncing between the two servers and they are syncing very quickly. – donutdan4114 Dec 19 '12 at 18:17
  • Assuming that it is an issue with the application, I'd probably check for implementations of hook_system_info_alter(), hook_js_alter() in enabled custom & contrib modules & themes. One of them could be inadvertantly doing this. – Amarnath Ravikumar Dec 19 '12 at 18:20
0

Turns out the issue was with a rogue server that was hitting our site. The old web server was hitting our database and caching the old files.

It was hard to find because the two servers had the same hostname for some reason.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.