Magento2: Sign-In Sign-Out problem

Created on 12 Feb 2020  路  19Comments  路  Source: magento/magento2

Preconditions (*)

  1. Magento 2.3.3
  2. Varnish 6
  3. Redis
  4. SSL enabled

Steps to reproduce (*)

  1. Header Sign-in link doesn't change into Sign-out after Sign-in to the store and navigating to category pages.
  2. See this video to reproduce. https://youtu.be/X1jqpPMOSVg

Expected result (*)

  1. After sign-in, the link should remain displaying sign-out till the user logs off.

Actual result (*)

  1. After sign-in, the link remains displaying sign-in. Header Sign-in link doesn't change into Sign-out after Sign-in to the store and navigating to category pages.
  2. See this video to reproduce. https://youtu.be/X1jqpPMOSVg
Format is valid Reported on 2.3.3

All 19 comments

Hi @monotheist. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

@monotheist do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

Hi @shikhamis11. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

Its a caching issue, we saw the same thing so I disabled the cache and the issue went away!

Seems like this has been doing the rounds for a while:

9156

20571

@devchris79 Is there a solution to this issue? I can't afford to disable cache.

As I understand it there was supposed to be a fix to load headers that were not cached last year, unfortunately this doesn't appear to work for you. I don't know if this is down to Magento core functionality or your theme (Ultimo) implementation of the sign in link.

I have done a bit more experimentation and the issue appears to be a Magento core caching issue. When Signed in I am sometimes seeing the account link display sign in while already signed in, I can then clear the full page cache while signed in and the issue disappears and pages behave normally for the signed on session.

Ultimo is using core functionality to add the sign in/out link:

issue

Issue was seen with Magento 2.3.4, Ultimo theme and only using the Magento Cache.

@devchris79 Thanks for checking on this. Really appreciate. Is there a possible workaround or fix?

Sorry but I don't have anything

@shikhamis11 Ultimo is using top.links from xml /vendor/magento/module-customer/view/frontend/layout/default.xml. This appears to be getting cached in the Magento full page cache and served incorrectly as if the user is signed out.

If I applied cacheable="false" to the authorization-link it works fine, but this kills the entire page cache as far as I know. It seems like Magento has been closing block hole punching through the cache, I have seen that knockout js appears to be used for dynamic data but its a bit beyond my knowledge.

Does this sound like the true issue or has the cachable = false just caused a regeneration that has masked the true root of the problem?

I have updated default.xml to the simplest form imaginable and the issue still seems to be there. I now have:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="top.links">
        </referenceBlock>
    </body>
</page>

I browse through a few pages, home screen, category, product page etc. while not signed in, then I sign in and browse, the sign in link will incorrectly appear on some pages.

@devchris79 thanks for all the information ..
did you try to reproduce the issue at magento clean instance without theme ?

Root of the issue seems to be in the Ultimo theme caching, I have taken this up with the authors and will let @monotheist know the outcome.

Luma and blank themes don't show the issue.

The issue appears to be a change in 2.3.2 that made view models shared by default, consequently the settings that are built up in cfg.css wouldn't be correct for all the view models (product view, homepage, cat view etc.) There is a shared=false attribute, but I have been unable to get that to work.

The layouts for all pages are defined in
/app/design/frontend/Infortis/ultimo/Infortis_Ultimo/layout/default.xml
this then brings in block
app/design/frontend/Infortis\base/Magento_Theme/layout/default.xml

My quick fix until a theme update was to simply disable the Ultimo caching, I did this by just adding a quick return false in there check:

/app/code/Infortis/Cgen/Plugin/Magento/Framework/App/FrontController.php

    protected function shouldCacheRequest()
    {
        $path = $this->getPathInfo();
        return false;
        return in_array($path, [
            'asset/dynamic/assets/m/iult/f/cfg.css']
        );

    }

If you have any suggestions please let me know. I would also recommend closing this issue as its not an issue in the Magento core.

@shikhamis11 Can you please close this issue as its not a core fault. The author monotheist tells me he is now using an alternative cart software.

@shikhamis11 Can you please close this issue as its not a core fault. The author monotheist tells me he is now using an alternative cart software.

Hi @devchris79 ,
I'm facing this issue on Magento version 2.4.1.
The header is still cached when I switched between websites.

@ngtuan96lc Did the theme code change not work?

We are still at Magento 2.3.5 because we are on a hosted service that doesn't support Elasticsearch. The Ultimo theme has been dead for a while now and I know that there are other issues with 2.4, why don't you consider a theme change as the issues are likely to get worse?

@shikhamis11 Ultimo is using top.links from xml /vendor/magento/module-customer/view/frontend/layout/default.xml. This appears to be getting cached in the Magento full page cache and served incorrectly as if the user is signed out.

If I applied cacheable="false" to the authorization-link it works fine, but this kills the entire page cache as far as I know. It seems like Magento has been closing block hole punching through the cache, I have seen that knockout js appears to be used for dynamic data but its a bit beyond my knowledge.

Does this sound like the true issue or has the cachable = false just caused a regeneration that has masked the true root of the problem?

If disable cache for a block named "top.links". It will affect performance.
so, we couldn't disable it.
Do we have any solution?

@ngtuan96lc yes cacheable = false is not recommended you can implement view models or load data through knockout js

The only way I found to stop the issue was with the post on Feb 24th.
If you find a better way of correcting the issue I would love to hear it so we can update our code.

The cachable=false command will kill all caching as far as I know.

Was this page helpful?
0 / 5 - 0 ratings