I think I've found the cause of the Async Mode error being displayed. The problem is in the advagg.install file when running the s3fs module. Each time the AdvAgg pages are loaded, the following error message is shown:

Adv CSS/JS Agg - Async Mode	Flush your caches.
You need to flush your menu cache. This can be done at the top of the performance page; under "Clear cache" press the "Clear all caches" button.

No matter how many times the cache is flushed, the error still occurs.

The cause of the issue is how the $css_path and $js_path arrays are used in the advagg_install_fast_checks function. In the block of code to check that the menu router handler is working, it first checks if $css_path[1] and $js_path[1] are not uris. By default, it seems as though these values could never be uris -- they are "advagg_css" and "advagg_js" respectively. (The uris exist in the 0 value of the array, for example, $css_path[0] = "public://advagg_css".)

The problem occurs on the next line where menu_get_item is run. This will never work when using S3, because "advagg_js/test.js" is always going to return an empty result. Based on how the code works, I can't see a situation where this code would not display an error.

The attached patch wraps the code in a !module_exists('s3fs') so that it is skipped if s3fs is present.

Let me know if there is a better way to handle this or something I might be missing. Thanks.

Comments

ron_s created an issue. See original summary.

sgdev’s picture

Status: Needs review » Closed (duplicate)

This separate patch is no longer needed, as the core issue is addressed here:

Add consistent support for the s3fs no_rewrite_cssjs setting
https://www.drupal.org/project/advagg/issues/2972528

sgdev’s picture

Status: Closed (duplicate) » Needs review

Sorry, did some additional testing and realized this patch is still applicable.

Going to remove the related code out of the Issue #2972528 patch.

mikeytown2’s picture

Status: Needs review » Needs work

So the whole idea behind this is to check that the drupal route for generating the css/js file works. I've had some issues with drush messing up these paths in the past; so it's just checking the advagg_js/% menu item in short. So in this case it should check $external_js as defined in advagg_menu(). I also have fallback generation located at the top of _advagg_process_html(). Given this info I feel like there might be some more work that needs to be done with this patch but I could be mistaken.

sgdev’s picture

Ok, let me look into this and see what I can do. Thanks.

sgdev’s picture

StatusFileSize
new2.41 KB

Attached is an update. I used the approach from advagg_menu, plus the existing code to determine menu paths for CSS and JS. It is conditionalized based on whether or not s3fs no_rewrite_cssjs is being used.

Take a look and let me know your thoughts. Thanks.

sgdev’s picture

Status: Needs work » Needs review
kleinmp’s picture

This is working for me.

sgdev’s picture

Anyone willing to set this as RTBC? Have been using this patch on live sites for the past year and a half with no issues.

thalles’s picture

Status: Needs review » Reviewed & tested by the community
thalles’s picture

Status: Reviewed & tested by the community » Fixed
thalles’s picture

  • thalles committed 40168c0 on 7.x-2.x authored by ron_s
    Issue #2972760 by ron_s, mikeytown2, kleinmp: Async Mode error "flush...
thalles’s picture

Thanks @all!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.