Why is Drupal 7 loading the wrong .js file? 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
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.