First of, I want to thank you for this truly great project, amazing work!

I recently had some problems with cron breaking the css/js and it turned out to that system_cron invalidated the cache_advagg_aggregates and cache_advagg_info caches. Simply clearing those made the css load once again.

I might add that it seems that it's only css files split into parts with selector limitor that arent loaded. The first part of the splits is, but not the others.

Currently it's not a problem for me personally as I can just clear those caches after cron runs but it seems to be either a bug, or something which could be incorporated in the module. What do you think?

Oh and I'm only running advagg, advagg_css_compress and advagg_bundler (bundling is disabled).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

oxyc’s picture

Issue summary: View changes
mikeytown2’s picture

I might add that it seems that it's only css files split into parts with selector limitor that arent loaded. The first part of the splits is, but not the others.

Can I get more details on this?

oxyc’s picture

I was able to reproduce it on a new installation as well, so it's definitely a bug.

Setps.

drush core-quick-drupal --profile=standard
...
drush dl elysia_cron
drush dl advagg --dev
drush en elysia_cron advagg advagg_css_compress

Next add a large css file to the theme, for example:

cd themes/bartik/css
wget http://www.snellman.fi/sites/all/themes/v3/css/v3.css
cd ..
echo "stylesheets[all][] = css/v3.css" >> bartik.info
drush cc all

Configure it to limit css selectors:

  • Visit admin/config/development/performance and check Aggregate and compress CSS files.
  • Visit admin/config/development/performance/advagg and check Prevent more than 4000 CSS selectors in an aggregated CSS file. I also set the limit to 4000.

Finally to reproduce the problem:

  • curl --silent http://advaggtest.example.org/ | grep "<link" | wc -l: 8
  • Visit admin/config/system/cron/execute/system_cron
  • curl --silent http://advaggtest.example.org/ | grep "<link" | wc -l: 6

Expected result on the last
count should be 8 but the css parts are not loaded. Clearing the cache or more specifically the advagg caches, makes it work again.

TRUNCATE `cache_advagg_aggregates`;
TRUNCATE `cache_advagg_info`;

curl --silent http://advaggtest.example.org/ | grep "<link" | wc -l: 8

jaydub’s picture

I was having this problem too and it seemed to correct itself when advagg was disabled or as noted when the max selectors option was disabled.

However now that I've disabled the max selectors option, cleared cache, loaded pages, then reenabled the selectors, cleared cache, loaded pages (after making edits) now I don't seem to be running into the problem. Will stay tuned in case I see issues again.

mpotter’s picture

I am also having this problem. Here is a patch that seems to solve it, but not sure if this is exactly what needs to be done. I defer to the module maintainer to tweak this.

mikeytown2’s picture

Status: Active » Needs review
rael9’s picture

FYI, this patch seems to work well for me. I thought it was an issue with secure_site, but this seems to actually be the issue/resolution.

oxyc’s picture

I'm still seeing issues with this patch, not sure if it's some different issue though.

Nevermind I noticed I had my custom cron setup set so advagg could run before system_cron. Guessing it will work when I adjusted it to run after system_cron.

rael9’s picture

Good call, oxyc. I started having issues again, too. I updated my settings to weight advagg after system_cron in my elysia_cron settings. I'll report back if that fixed my continuing issues.

mrmikedewolf’s picture

We ran into this issue on a project we were working on where we need to split up our stylesheet due to IE < 10 max selectors in a file rule. Thanks to #5 for identifying and patching the issue. We found, however, that we also needed to change the Advagg modules weight in the system table as per #8 and #9. I've updated the patch to implement this weight change both on enable and as an update.

rael9’s picture

Just a quick update, since changing the order of the cron jobs so that advagg cron is running after system cron, we haven't had any further issues thus far.

mrmikedewolf’s picture

Doh, stupid mistake in my patch, I weighted Advagg less than system during updates, not more. Never code too hastily.

rael9’s picture

I have had 1 incident of this happening again since the cron order change on the 10th. I couldn't find anything in the logs pertaining to this, but it some what troublesome that it did happen again, even as an isolated incident.

mikeytown2’s picture

mikeytown2’s picture

New patch that doesn't need a css_emimage patch
#2230047-2: Use drupal alter for advagg_get_info_on_file(s)

Fabianx’s picture

+++ b/advagg.module
@@ -393,6 +393,16 @@ function advagg_menu() {
 function advagg_cron($bypass_time_check = FALSE) {
+  // clear caches per https://drupal.org/node/2216825
+  if (db_table_exists('advagg_aggregates_versions')) {

Uhm, this whole section should be after the !$bypass_time_check ...

Else this is pretty senseless.

We altered out the implementation of advagg_flush_caches via module_implements_alter() and now only 24 hours caches are rebuild instead of 10 min ...

mikeytown2’s picture

Status: Needs review » Closed (duplicate)

Going to mark this a duplicate of #2230047: Use drupal alter for advagg_get_info_on_file(s) as I believe this issue has been fixed in there.