4

Strange behavior in Magento 2.2.8! When I leave the page for a few minutes and then do a refresh, products from other user sessions are in my cart! 20 minutes refreshing and there are 17 products in my cart and I didn't do anything. I do not use SID in the URL.

Update: Disabling full page cache didn't work, added my env.php. The problem occurs on 2 sites, one in magento 2.2.8 and one in 2.3.1. Configuration is Nginx - Apache - Redis - php 7.1

Also, it didn't matter what kind of session caching I use (database, files or Redis)

'resource' => [
    'default_setup' => [
        'connection' => 'default'
    ]
],
'x-frame-options' => 'SAMEORIGIN',
'MAGE_MODE' => 'production',
'session' => [
    'save' => 'redis',
    'redis' => [
        'host' => '127.0.0.1',
        'port' => '6379',
        'password' => '',
        'timeout' => '2.5',
        'persistent_identifier' => '',
        'database' => '2',
        'compression_threshold' => '2048',
        'compression_library' => 'gzip',
        'log_level' => '3',
        'max_concurrency' => '6',
        'break_after_frontend' => '5',
        'break_after_adminhtml' => '30',
        'first_lifetime' => '600',
        'bot_first_lifetime' => '60',
        'bot_lifetime' => '7200',
        'disable_locking' => '0',
        'min_lifetime' => '60',
        'max_lifetime' => '2592000'
    ]
],
'cache_types' => [
    'config' => 1,
    'layout' => 1,
    'block_html' => 1,
    'collections' => 1,
    'reflection' => 1,
    'db_ddl' => 1,
    'eav' => 1,
    'customer_notification' => 1,
    'config_integration' => 1,
    'config_integration_api' => 1,
    'full_page' => 0,
    'translate' => 1,
    'config_webservice' => 1,
    'compiled_config' => 1,
    'vertex' => 1
],
'install' => [
    'date' => 'Thu, 17 May 2018 11:30:44 +0000'
],
'cache' => [
    'frontend' => [
        'default' => [
            'backend' => 'Cm_Cache_Backend_Redis',
            'backend_options' => [
                'server' => '127.0.0.1',
                'database' => '0',
                'port' => '6379'
            ]
        ],
        'page_cache' => [
            'backend' => 'Cm_Cache_Backend_Redis',
            'backend_options' => [
                'server' => '127.0.0.1',
                'port' => '6379',
                'database' => '1',
                'compress_data' => '0'
            ]
        ]
    ]
]
];
13
  • Fresh installation? Do you install any third party caching module?
    – Sohel Rana
    Apr 29, 2019 at 18:23
  • I use redis and did a refresh of i several times Apr 29, 2019 at 18:25
  • Do you use varnish or FPC? May 7, 2019 at 19:16
  • Yes, redis caching May 7, 2019 at 19:37
  • @JilcoTigchelaar, is this in production? or the site in under development? this is due to temporary domain used across several projects may be. May 8, 2019 at 10:38

2 Answers 2

1

If you are having this problem across multiple different installations using different versions of Magento, then I suggest it is an issue with caching on your local machine.

Please clear your browser cache directly from the browser settings and then close the browser. Empty temp directories. If CCleaner is installed, tick all of the cache/session options for your web browser and run CCleaner to clear up any files you might have missed.

Open your browser again and test the website.

If the problem persists, try again on a different browser with an empty cache after rebooting your machine. I've noticed that, with Firefox at least, some things are persistent which should not be persistent.

If you still get this problem, then disable all unnecessary modules, run cache:flush, setup:upgrade, setup:di:compile and setup:static-content:deploy -f.

Can you please provide an explanation of the process you use when you make a fresh installation?

EDIT:

Please could you try removing the redis settings from your env.php for only the session cache, but continue using redis for default and full page cache.

Although it is not exactly a solution, it should allow your site to load quickly without interfering with orders.

I would suggest that you raise this issue on the Magento 2 github page.

If you are following the standard server setup instructions and using a vanilla install of magento then it sounds more like a bug than a mistake you've made.

8
  • I cant ask al customers to clean their browser before they visit my webshops. Thats not an option, the deploy and static content rebuild i did several times but without succes May 13, 2019 at 6:20
  • That is not what I meant. I simply meant that it could be an issue with the cache on your local development machine, but that users newly visiting your shop may not experience the same issue. When you said you see cart items from other user sessions, I thought you meant you see items from user sessions that you have created yourself. Are you seeing cart items from sessions created by other people?
    – Muckee
    May 13, 2019 at 11:11
  • @JilcoTigchelaar please see my edited answer. Using redis for full page cache and default cache, but disabling it for session cache, should provide a workaround for the problem. You could look at running redis alongside memcached if you don't want to use varnish.
    – Muckee
    May 13, 2019 at 11:27
  • @joshau Flood, i also tried DB sessions and file session. In al the cases the problem continues... May 13, 2019 at 11:38
  • @JilcoTigchelaar then please provide further information about your server configuration, database installation/configuration and magento installation/configuration. There must be some commonality which causes this issue, else we would all be experiencing it.
    – Muckee
    May 14, 2019 at 14:49
0

It was a long search,but it was a problem with microcaching in engintron Nginx.

Ad this to your custom rules and the problem is gone

if ($SITE_URI ~* "yoursite.nl") {
   set $CACHE_BYPASS_FOR_DYNAMIC 1; # Disables micro-caching
   set $CACHE_BYPASS_FOR_STATIC 1; # Disables static file caching
}
2
  • So you are disabling engintron caching? May 20, 2019 at 21:06
  • A part of the caching, micro caching Jun 18, 2019 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.