Download & Extend

Admin menu disappears randomly (again) if client-side cache option enabled

Project:Administration menu
Version:7.x-3.x-dev
Component:Code
Category:bug report
Priority:major
Assigned:Unassigned
Status:needs review

Issue Summary

I'd reopen #442560: Admin menu disappears (randomly), needs either cache to be emptied on every page or page refresh several times but it's been locked...

I've just updated to RC3 from RC1 + patch from http://drupal.org/node/442560#comment-5139840 and the problem has reappeared.

Comments

#1

I made this change in the module code. This kills the menu cache but at least the menu shows up and works properly.

/sites/all/modules/admin_menu/admin_menu.module
Line 335: $cache = NULL; //drupal_page_get_cache(); // This cache causes the menu to disappear sometimes

#2

@jacmkno: The line right after that checks whether there is any $cache.

So what you're saying is that the $cache record created by Drupal core, if returned, does not contain the menu.

In turn, I'd like to know what a var_dump($cache) shows in that case.

#3

Same issue using the same version (7.x-3.0-rc3). I had to kill the menu cache as well by using the method mentioned in #1.

@sun if you can briefly explain to me where to put the function var_dump($cache) so I can get you that output I would be happy to do that.

Thanks

#4

When the menu disappears again, execute these steps in the exact order:

  1. Enable Firebug or whichever browser console, so you see Ajax requests being performed.
  2. Reload/re-access the page.
  3. Copy the Ajax request's URL, which should look along the lines of:

    http://your.domain/js/admin_menu/cache/414f4468da483ed136463b262bdf6b88

  4. Access that URL directly. (It will probably show an empty page.)
  5. Inject a var_dump() into admin_menu.module, line 335:
      $cache = drupal_page_get_cache();
      var_dump($cache);
  6. Reload that URL. Save the page into a .txt file, and attach it here.

#5

Title:admiin menu disappears randomly (again)» Admin menu disappears randomly (again)

#6

Interestingly, I set up a new site today with the latest admin_menu downloaded by drush, and didn't see any problems with it.

Perhaps the problem is with upgrading from an earlier version?

(Not at my main machine, so can't do the ajax debug right now, sorry!)

#7

Subscribed. We are having this same issue here on random machines. Have applied the work around in #1 for now, however the load time for the menu is now brutally slow.

#8

@joachim: That's interesting, but I rather suspect a platform/environment difference. That is, because earlier versions also used a cache, and all caches are entirely flushed when running update.php, so there's really no chance of stale data leaking into the current version.

#9

@sun, I've tried to follow the steps you gave me and got to step 4. Instead of showing me a blank page it gave me this:

Content Encoding Error
The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.
Please contact the website owners to inform them of this problem.

I tried to continue on with the steps, but it continued to give me this error. Any ideas on what this means?

One thing to note. That URL in the console shows an error normally, but when I comment out line 335 the error goes away.

#10

Err, ok. The entire intention of replacing admin_menu's custom caching with Drupal core's regular page cache was to finally get rid of and resolve that content-encoding error. ;)

Since we're using straight core functionality now, my suspicion is that this must actually be a bug or weirdness in Drupal core's page caching. Searching for the error you mentioned yields:

http://drupal.org/project/issues/drupal?text=content+encoding+error
http://drupal.org/project/issues/drupal?text=cache+content+encoding

It's noteworthy that most of those issues are reporting differences in reproducing the respective issue

1) in different browsers
2) with varying aggregation + compression options in the system performance settings
3) with different web servers
4) depending on the existence of a reverse-proxy (e.g., Varnish, Akamai, etc)

In any case, can you still complete steps 5+6, please? The dumped $cache should show HTTP response headers and the actual content being sent.

#11

There must be something I'm not understanding here. I've attached a .txt file of the saved page with the dumped $cache, but as you can see it's not giving any useful information other than the error I already gave you. Is there a certain way I am supposed to save the page?

AttachmentSizeStatusTest resultOperations
cf8f468f5fd6499c1e931a1f1f884c1f.txt229 bytesIgnoredNoneNone

#12

Here are some response and request headers from the firebug console:

Response Headers

Cache-Control     private, max-age=31536000
Connection        Keep-Alive
Content-Encoding  gzip
Content-Language  en
Content-Type      text/html; charset=utf-8
Date              Thu, 05 Jul 2012 17:47:51 GMT
Etag              "1341509869-1"
Expires           Fri, 05 Jul 2013 17:37:49 +0000
Keep-Alive        timeout=5, max=89
Last-Modified     Thu, 05 Jul 2012 17:37:49 GMT
Server            Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0g DAV/2 mod_bwlimited/1.4
Transfer-Encoding chunked
Vary              Cookie,Accept-Encoding
X-Drupal-Cache    HIT

Request Headers
Accept            text/plain, */*; q=0.01
Accept-Encoding   gzip, deflate
Accept-Language   en-us,en;q=0.5
Connection        keep-alive
Cookie            Drupal.tableDrag.showWeight=0; Drupal.visitor.admin_compact_mode=1; __utma=13249770.602854895.1330422802.1341502229.1341508646.135; __utmz=13249770.1330422802.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); SESSda042bd25c19aae0262aebd419c2da4c=H1-SIuqx0g7rpq0w7uwGsiTCdT8Iqm7SYBtnLDPx8kk; ctools-collapsible-state=views-ui-advanced-column-resource_center_search%3A1%2Cviews-ui-advanced-column-resource_center_browse%3A1%2Cviews-ui-advanced-column-weight%3A1%2Cviews-ui-advanced-column-control_content%3A1%2Cviews-ui-advanced-column-speakers%3A1%2Cviews-ui-advanced-column-wishlist%3A1%2Cviews-ui-advanced-column-reviews%3A1; has_js=1; __utmc=13249770; __utmb=13249770.7.10.1341508646
User-Agent        Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1
X-Requested-With  XMLHttpRequest

#13

Huh. I've reverted my revert of the update to rc-3 and now I can't reproduce the problem! Just spent 5 minutes walking round my localhost and admin menu shows up everywhere!

#14

Ok I've now got this going wrong on another local site I've just updated:

Enable Firebug or whichever browser console, so you see Ajax requests being performed.
Reload/re-access the page.
Copy the Ajax request's URL, which should look along the lines of:

Maybe I'm doing this wrong, but I don't actually *see* the ajax request there at all.

I'm in Firebug's 'Net' tab, with 'All' selected. All I get after the initial URL request is JS, CSS, and image files.

EDIT: Never mind, a cache clear in the right drush alias (doh!) fixed it.

#15

Version:7.x-3.0-rc3» 7.x-3.x-dev
Status:active» needs review

@deggertsen: Did you check any of the core issues I linked to in #10?

@all: Is it possible that you only get this error with Firefox?

http://support.mozilla.org/en/questions/754411
http://support.mozilla.org/en/questions/931166

Also, I somewhat doubt that attached patch changes anything, but can you try it? You need to clear your browser cache + flush Drupal caches after applying it.

AttachmentSizeStatusTest resultOperations
admin_menu.cache_.15.patch544 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 228 pass(es).View details | Re-test

#16

The patch doesn't seem to help.

There are a lot of core issues in #10. I have not reviewed them all, though it seems likely that it's a core issue rather than an issue with admin menu.

I've confirmed that at least for me the problem is only when I'm using firefox.

I just tried something that does seem to have fixed it for now though. I had tried clearing my browser cache before, but not cookies. So I went in and removed all cookies for the site and now it appears to be working just fine. This is with the patch still applied. I am now wishing I would have paid closer attention to the cookies I removed to see if I could see which one was causing the problem, but for now at least that fixed it.

I tried this because of the link (http://support.mozilla.org/en-US/questions/931166) you referred me to.

If the issue comes back up again I will pay closer attention to the cookies.

#17

Priority:critical» normal
Status:needs review» active

I've found that I can fix it by removing a cookie for the site in firefox with the following info:
name: SESSda042bd25c19aae0262aebd419c2da4c
content: 86I0oG9N4Ux9sBmyDDs4cYRxpE8V21gHbvg_vjwgD4w

It seems to be a firefox session cookie. When I remove the cookie I have to log back in, but the menu will work for awhile until it stops working again. Don't know if this information helps anyone, but for now I'm just gonna have to go with the workaround from #1 or use chrome instead of firefox.

#18

same issue (admin menu randomly disappearing and reappearing after clearing cache) appearing in chrome as well. i would like to apply hints in #1 but can't find the place to put that line. as far as i understand the line
$cache = NULL
should be inserted. it would be nice to include the line before and after the line to be inserted so i can find the proper place in admin_menu.module.
btw: my version is 7.x-3.0-rc2

regards
karl

#19

Same problem.

What is funny is than I have the admin menu in seven but on my front-end theme it disappear and only appear one after a cache clear.

My theme is subtheme of the html5 version of http://drupal.org/project/mothership

EDIT: #1 doesn't help so I think is another problem.

#20

Priority:normal» major

Same problem here too... Just started today though???? And, it's not just a Firefox issue. Does the same thing in IE 9.

#21

Status:active» needs review

#15: admin_menu.cache_.15.patch queued for re-testing.

#22

Tested this on FF, Chrome, and IE9, and it is not working. Tried the patch in #15 to no avail.

Also tested this on WIndows running Apache, and Ubuntu running Nginx with the same result.

I am running 7.x-3.0-rc3 (patched from #15 above) and Drupal 7.15. Neither of the sites I am troubleshooting this issue on have page/block caching or CSS/JS compression turned on.

Something is seriously wrong with the core page caching integration, or the core page caching itself it seems.

In the end I have applied the hack in #1, as I use Admin Menu on every site I run/build and it's being downloaded by Drush as the recommended release.

#23

For good measure, I have tried the steps in #5, and get no response after injecting the var_dump($cache);.

In fact, I get an error:

Firefox Error
Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error.

Chrome 21 Error
The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.

I have absolutely no clue what those mean, but perhaps you can gain some insight form them to fix this issue.

Good luck and thanks for your hard work and dedication to the Drupal project.

#24

I've been dealing with this for a few hours... Unchecking 'Cache menu in client-side browser' seemed to fix it.

#25

I have been using Administration menu and its toolbar (7.x-3.0-rc3) for some weeks on a site I am developing, so far on localhost, with the development machine running Windows 7 SP1 and Firefox. I only started suffering from the toolbar disappearing (and very occasionally reappearing) apparently at random in the last few days and it seemed to start after Firefox updated itself to version 15.0 - although I cannot be sure that this is what set it off.

I have tried unchecking 'Cache menu in client-side browser' as suggested in #24 and, so far (fingers crossed), it has not happened again.

#26

Just to give my 2cents.
The Admin menu was and is perfectly working on my localhost test (apache 2.2.16 web server on ubuntu).
Just uploading the website to the stage server (apache 1.3.42 on CentOS) and it stopped working.
Could it be server-side related?

Anyway unchecking 'Cache menu in client-side browser' as suggested in #24 works.

#27

Title:Admin menu disappears randomly (again)» Admin menu disappears randomly (again) if client-side cache option enabled

I can confirm #24 as well. Disabling "Cache menu in client-side browser" has resolved the issue for our team. (OSX Chrome.)

This seems to be browser-release-specific. Unlike as reported above, from what I can recall, I have not had this problem with the most recent Firefox releases. Was this affecting earlier releases? Or FF on certain OSs? I've noticed the disappearance issues in OSX Chrome, which is my primary browser. I'll watch for it now while working in FF.

#29

Sad to say that unchecking "Cache menu in client-side browser" does not fix it for me in Firefox v16; in fact, doing so makes the admin menu ALWAYS invisible. Wish I could get this situation fixed as refreshing just to get the admin menu on every other page load is quite annoying.

The 20px top margin is always working, but the menu is invisible. Refreshing usually fixes the issue-- sometimes it takes multiple refreshes.

#30

Just noting another success for disabling Cache menu in client-side browser in /admin/config/administration/admin_menu

I was experiencing the issue in IE8.

#31

#24 works for me as well on Chrome (OSX and Win).

For #29: I also have the patch from #15. Do you have it applied?

#32

#24 disabling "Cache menu in client-side browser" at admin/config/administration/admin_menu works for me too!

#33

Same thing here. In my case, I had the Agreement module enabled and, when logged in as anything but the admin user (admins bypass the agreement page), if I tried to navigate to another page or bypass the agreement in some way, the admin menu would disappear and the agreement form was duplicated at the bottom of the page. Disabling "Cache menu in client-side browser" resolved both of these issues.

To reproduce, just enable admin_menu, admin_toolbar and agreement modules. Go to agreement settings (admin/config/people/agreement) and select "On every login" under Frequency. Enter some test text in the Agreement Text field. Log out and log back in as a "regular" (non admin) user who has the "Access administration menu" permission. You should see the admin menu and the agreement page. Try navigating to another page: admin menu disappears and agreement form is duplicated at bottom of page. Try submitting agreement without checking "I agree" and same thing happens. If you disable "Cache menu in client-side browser" admin_menu and agreement both work as they should. Tested in FF 18.0.1 and Chrome 24.0.1312.56.

See also #1900442: Agreement form appears twice if user tries to navigate to another page without accepting it first.

#34

#24 works for me as well, Chrome, Mothership child theme. It would be great if one of the module maintainers could add a comment at the end of the closed issue for others looking for fixes to this problem.

#35

#1 and #24 work. Are they doing the same thing?

#36

None of these solutions work for me. Every time I change and then save a view, I have to flush the admin menu cache to see any links.

Is there a simple way to just have the flush happen automatically?

#37

I agree with muranod, something needs to be evaluated because it is very frustrating to have to reload the page to see or use the admin menu. (My comment was #29).

#38

I think that the problem here unfortunately is the "Content-Encoding : gzip" enabled on the server. Please check if you have the content encoding enabled when the issue occurs.

#39

Am seeing this with v7.x-3.0-rc4 (using an AdaptiveTheme subtheme) even after disabling the "cache" option, have not dug into the problem yet.

#40

mpastas should we check on HTTP headers?
If it's so... I don't have it.

Should we check on specific pages / gets or any?
Additionally... with the "cache" option enabled or disabled?

#41

Sorry, Gzip discarded. Gzip is not the problem here. But it only happens on the staging server, never on a localhost.

#42

@mpastas: I've had the problem arise on a local dev install (using MAMP).

#43

On my localhost no problems with admin_menu but
on the server the admin_menu doesn't work when selecting subs of content and some of the structure subs.
Instead I get a very large treemenu at the bottom of the page....
(Cache menu in client-side browser is not selected)

#44

Locahost was on DAMP(windows) and the Server is Unix.
I also got a messages that some temp. files couldn't be copied
the local file system path where temporary files will be stored wasn't configured properly.
Don't know what the path should be?

I disabled "aggregate and compress CSS files" and "aggregate JavaScript files"
Now behaviour as expected.

#45

#46

@rvdtuin: I've had the problem happen on local sites when JS aggregation is disabled.

#47

I've tried enabling / disabling js & css aggregation & menu caching, but it still happens whenever I install a new module and every time I edit and then save a view. That's always two steps: Save the view / clear admin cache. (both on my DEV and LIVE sites.)

#48

Same problem here.

I have five roles and two of them with permissions to see admin menu and access drupal links (admin/people/permissions and the checkboxes for that are checked for these two roles). The administrator role can see everytime the admin menu black bar but another roles (Editor, Moderator) can't. When I check the permissions page, the checkboxes for admin menu turn onto disabled state.

I think it's a cache problem, but I don't know yet why this checkboxes turned onto a disabled state...

I hope I can find a solution soon.

nobody click here