backdrop-issues icon indicating copy to clipboard operation
backdrop-issues copied to clipboard

Admin menu occasionally vanishes

Open stpaultim opened this issue 6 years ago • 30 comments

Description of the bug

While working with flexible layouts, occassionally I loose the admin menu. It just vanishes.

News_Page___Hosted_Backdrop_CMS_Websites_-_By_Triplo

I must logout and log back in to get it to come back.

~Flushing caches does not help at all.~ (EDIT: Clearing the cache does in fact fix it)

When it is gone, it's gone from the markup as well. I can't find the admin menu with page source, so it just doesn't seem to render.

I can't provide reliable steps to reproduce yet and can not be certain that it has anything to do with flexible layouts. But, I am reasonably convinced that it is happening only while working with a page generated by a flexible layout template.

If anyone else has experienced this, please let me know. I've been seeing this for several days, but not with any rhyme or reason. It seems relatively random and I can go long periods without having it happen, today it's happening a lot.

Once it is gone on a single page, it affects all pages.

This is on a site with lots of modules and using my custom theme, so there are many possible factors. I will continue to work on sorting out a more precise cause.

There is nothing in watchdog logs.

EDIT (March 1, 2021): This is happening on a BackdropCMS.org site at the moment. See: https://github.com/backdrop/backdrop-issues/issues/4168#issuecomment-788558810

It seems to be related to "Compress Cached Pages."

stpaultim avatar Oct 28 '19 03:10 stpaultim

Apologies - clearing the cache does resolve it and bring back the menu.

stpaultim avatar Oct 28 '19 03:10 stpaultim

I don't think this is a core issue, since I think I've only had this with my custom distribution. I'm not sure that it has anything to do with Flexible Layouts. Not sure how to debug this.

stpaultim avatar Dec 10 '19 02:12 stpaultim

Have you determined if this is a CSS or menu rendering issue @stpaultim? ...in other words, if you inspect it, are there any menu items in the DOM? Perhaps their text gets rendered with the same color as the admin bar background. Perhaps it's a z-index issue.

PS: note to self: I vaguely recall some bug with flickering or something, and us resorting to adding an empty black bar at the top. Perhaps it's that(??).

klonos avatar Dec 10 '19 03:12 klonos

When it is gone, it's gone from the markup as well. I can't find the admin menu with page source, so it just doesn't seem to render.

No, the menu is not rendering. It's not a CSS thing.

stpaultim avatar Dec 10 '19 07:12 stpaultim

@BWPanda shared this in Gitter:

I had this very issue on a site I just launched. It turned out to be a bug in some unrelated JS. It basically caused all following JS to muck up as well. You might be able to confirm this by seeing if fieldsets are working on pages when the admin menu is gone. Or check the JS console log. (For me, when the JS bug caused the admin menu to disappear then fieldsets didn't have the ability to expand/collapse, as that was done by JS too)

stpaultim avatar Dec 10 '19 07:12 stpaultim

Hmmm 🤔 ...would be great to be able to reproduce this with very minimal steps.

klonos avatar Dec 10 '19 22:12 klonos

I agree, I would love to be able to get steps to reproduce. Last night, it was happening to me every 5 minutes. But, I could never reproduce it deliberately.

Today, I've been working on the same site for 3 hours and it only happened once.

stpaultim avatar Dec 10 '19 23:12 stpaultim

🤔

klonos avatar Dec 11 '19 20:12 klonos

I'm going to close this issue. It's still happening to me on some older sites, but I've not experienced it on newer sites. This leads me to believe it is NOT a core issue, but something I did to some of my sites.

stpaultim avatar Sep 29 '20 01:09 stpaultim

Again, I have no reason to believe that this is a core issues, since it seems specific to 2-3 of my sites. However, I finally got a clue as to what might be causing it. I'm getting this error in the JS console. But, I don't know what that means.

Selection_014

stpaultim avatar Dec 02 '20 05:12 stpaultim

This has been a serious problem on one site recently. Turning off "compress cached page" is at least a temporary solution. Still not sure exactly why this is happening.

admin/config/development/performance

stpaultim avatar Dec 18 '20 00:12 stpaultim

@stpaultim Interesting... Based on the error message in your screenshot above, I searched and found this article: https://appuals.com/how-to-fix-err_content_decoding_failed-error/ Their first solution is to disable g-zip encoding. Since you said turning off page compression fixes the issue for you (which I assume uses g-zip), maybe that's the problem (or at least related to it)...

ghost avatar Dec 18 '20 00:12 ghost

This has been a serious problem on one site recently.

Hm, if you do not have any other sites on the same server and this site is the only one with that problem, it might be a problem with double compression.

Possibly related: https://github.com/backdrop/backdrop-issues/issues/4748

indigoxela avatar Dec 18 '20 07:12 indigoxela

Hm, if you do not have any other sites on the same server and this site is the only one with that problem, it might be a problem with double compression.

This occurred to me as well. But, I do have other sites and other Backdrop CMS sites on this server. I'll check to see if the other sites have "compress cached pages" turned off. NOTE: This server is running NGINX.

I've been a bit too busy this week to look into this further yet.

stpaultim avatar Dec 18 '20 20:12 stpaultim

The interesting thing here is that NGINX only compresses text/html out-of-the-box. All other mime-types have to be added manually

Apache on the other hand, compresses everything out-of-the-box and you have to tell it what NOT to compress...

It does sound like a double compression issue though. Enabling "Compress cached pages" creates the js.gz and css.gz files, then the webserver is trying to dynamically gzip those gziped files.

philsward avatar Jan 20 '21 07:01 philsward

Finally, this is happening on another site (I am happy, because it suggests that this was not just something crazy that happened to me).

I've turned off "Compress Cached Pages" to see if that also solves it here.

It is happening on the new https://events.backdropcms.org site, which also happens to be hosted on an Nginx server.

I think that maybe we need to reopen this ticket.

It seems that if I click around randomly for long enough after enabling "Compress Cached Pages" I can count on the admin bar disappearing, which requires me to logout and log back in. Last time I tried, it took 25 random clicks on admin bar before it happened. Has not happened at all, if "Compress Cached Pages" is turned off.

stpaultim avatar Mar 02 '21 03:03 stpaultim

I was just having this same problem again on a NEW site. I'm a little puzzled about why others are not reporting this problem.

I turned off all the Compress cached pages and things are working better.

This is being hosted on Nginx. Maybe that is why others aren't reporting it. Maybe it's specific to Nginx and maybe most of our users are on Apache.

stpaultim avatar Jun 29 '21 18:06 stpaultim

Yeah, I only use Apache.

ghost avatar Jun 29 '21 20:06 ghost

Still an issue on Apache with latest core. The bar disappears very often as soon as the compressed pages option is activated.

I think I remember a similar from the very old days of Drupal 7.xx. If anybody has any news about this, I'd be very interested.

Alternatively, is there a way to selectively cache all the rest and exclude the admin bar ?

Numerizen avatar Nov 08 '22 08:11 Numerizen

Still an issue on on Apache

@Numerizen so far the problem has only been reported with Nginx. You seem to be the first seeing this with Apache.

If you turn compression off, but keep all other caching on - does the problem still occur? Can you provide some details about your hosting?

indigoxela avatar Nov 08 '22 08:11 indigoxela

I'll have to test with compression off but caching on. Configured the website like so, will report later on the result. Seems to work so far, but I didn't test extensively.

As a temporary workaround, one can disable the cache management in the module's .module file (lines 216 and below).

As for the hosting details, nothing special really : classic LAMP stack with following modules :

core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 headers_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 passenger_module (shared)
 php7_module (shared)
 proxy_module (shared)
 proxy_connect_module (shared)
 proxy_html_module (shared)
 proxy_http_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 socache_shmcb_module (shared)
 speling_module (shared)
 ssl_module (shared)
 status_module (shared)
 xml2enc_module (shared)

Let me know if you need any more info.

Numerizen avatar Nov 08 '22 08:11 Numerizen

I'll try to replicate this issue on Apache. @Numerizen you say:

As a temporary workaround, one can disable the cache management in the module's .module file (lines 216 and below).

Which module are you referring to?

argiepiano avatar Nov 10 '22 13:11 argiepiano

Sorry, I thought it was obvious : I commented the code in the admin_menu.module, but I now realize that if it has something to do with compression, it may not accomplish much.

It's the code about the hash in admin_bar_preprocess_page after the call to admin_bar_cache_get.

Numerizen avatar Nov 10 '22 16:11 Numerizen

... but I now realize that if it has something to do with compression ...

How are the results of your tests with compression off, but caching on? After some days you might be able to see, if the problem's related to that setting.

Do you have access to Apache's deflate.conf (somewhere in /etc)?

indigoxela avatar Nov 11 '22 06:11 indigoxela

Here is the content of /etc/apache2/mods-available/deflate.conf.

<IfModule mod_deflate.c>
        <IfModule mod_filter.c>
                AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
                AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
                AddOutputFilterByType DEFLATE application/rss+xml
                AddOutputFilterByType DEFLATE application/xml
        </IfModule>
</IfModule>

As for the behaviour with compression disabled, time will tell and I'll report here.

Numerizen avatar Nov 11 '22 08:11 Numerizen

I have been experiencing a very similar issue, with the updated admin menu (I'm running B 1.28.2) presenting with no menu items. Clear the cache and it comes back, but as soon as I click anywhere else the menu disappears again. In Chrome the developer's console shows a jQuery error: image

I've checked in Firefox (in case it was a browser issue) and it's just the same. All caching switched off on admin/config/development/performance.

This has appeared on several of my sites yesterday when I went through the process of updating to 1.28.2. May well be a common cause because of the combination of modules I typically use, but I've not spotted it yet.

I switched to jQuery 3 at admin/config/development/jquery but it made no difference - error displayed is the same and the menu items are still missing.

nattywebdev avatar Jul 11 '24 09:07 nattywebdev

Further to this, the admin menu is being built in the DOM but simply not displayed in the right place and so invisible on the page.

nattywebdev avatar Jul 11 '24 09:07 nattywebdev

@nattywebdev many thanks for the details.

I see that the console error's collapsed. Could you expand it for a more complete debug report. Or export it (as text)?

Some script on your site seems incompatible with a recent jQuery, at least, that's my current assumption.

indigoxela avatar Jul 11 '24 09:07 indigoxela

No problem: hope it can help:

jquery.1.12.js?v=1.12.4:3 Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
    at Ra (jquery.1.12.js?v=1.12.4:3:27399)
    at Sa (jquery.1.12.js?v=1.12.4:3:27473)
    at Function.css (jquery.1.12.js?v=1.12.4:3:30895)
    at Object.get (jquery.1.12.js?v=1.12.4:3:31093)
    at Function.css (jquery.1.12.js?v=1.12.4:3:30867)
    at jquery.1.12.js?v=1.12.4:5:406
    at Y (jquery.1.12.js?v=1.12.4:3:4661)
    at n.fn.<computed> [as height] (jquery.1.12.js?v=1.12.4:5:177)
    at Backdrop.adminBar.behaviors.positionFixed (admin_bar.js?v=1.28.2:155:28)
    at Function.<anonymous> (admin_bar.js?v=1.28.2:115:11)
Ra @ jquery.1.12.js?v=1.12.4:3
Sa @ jquery.1.12.js?v=1.12.4:3
css @ jquery.1.12.js?v=1.12.4:3
get @ jquery.1.12.js?v=1.12.4:3
css @ jquery.1.12.js?v=1.12.4:3
(anonymous) @ jquery.1.12.js?v=1.12.4:5
Y @ jquery.1.12.js?v=1.12.4:3
n.fn.<computed> @ jquery.1.12.js?v=1.12.4:5
Backdrop.adminBar.behaviors.positionFixed @ admin_bar.js?v=1.28.2:155
(anonymous) @ admin_bar.js?v=1.28.2:115
each @ jquery.1.12.js?v=1.12.4:2
Backdrop.adminBar.attachBehaviors @ admin_bar.js?v=1.28.2:114
(anonymous) @ admin_bar.js?v=1.28.2:39
i @ jquery.1.12.js?v=1.12.4:2
fireWith @ jquery.1.12.js?v=1.12.4:2
y @ jquery.1.12.js?v=1.12.4:4
c @ jquery.1.12.js?v=1.12.4:4
XMLHttpRequest.send (async)
send @ jquery.1.12.js?v=1.12.4:4
ajax @ jquery.1.12.js?v=1.12.4:4
Backdrop.adminBar.getCache @ admin_bar.js?v=1.28.2:74
(anonymous) @ admin_bar.js?v=1.28.2:100
(anonymous) @ admin_bar.js?v=1.28.2:561
jquery:1 Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received

nattywebdev avatar Jul 11 '24 10:07 nattywebdev

Seems like I've found the cause and it's peculiar to me. I had a stray template.php file in my default theme, a subtheme of Bootstrap 5 Lite.

It contained this:

<?php
/**
 * @file
 * template.php
 */

I deleted the file and suddenly the admin menu bar is behaving.

nattywebdev avatar Jul 11 '24 10:07 nattywebdev