• Resolved tornevall

    (@tornevall)


    From WooCommerce 6.5.1 and 6.6.0, I think something has happened to the session handler. When I’m rolling back to 6.5.0, it works better but something still is weird; it takes a little bit longer before the problem occur. It is described like this:

    * Put a product in the cart.
    * Go to the cart review page. For 6.5.1 and 6.6.0, the session seem to expire instantly and the cart goes empty. Going directly to the checkout page has the same result but depending in the gateway I get noted about the expired session too.

    For 6.5.0, this is slightly better and it takes up to a minute before the session gets invalidated. I’ve tracked the issue down to class-wc-session-handler.php at this control where the session/cookie goes invalid (so for this case I’m trying to shop as a guest):

    		// If user has logged out, session cookie is invalid.
    		if ( ! is_user_logged_in() && ! $this->is_customer_guest( $this->_customer_id ) ) {
    			return false;
    		}
    

    I however currently don’t know why this happens, except for if I roll back the woocommerce furthermore, the problem vanishes entirely. I run a test platform with WP 6.0, and when I disable all the plugins except WooCommerce, it also seem to work better. But with no plugins enable, the purpose with WooCommerece also slightly changing ??

    Do you have any advice of how I can test for more errors and eventually make the user session not go invalid?

    • This topic was modified 2 years, 5 months ago by tornevall.
    • This topic was modified 2 years, 5 months ago by tornevall.
    • This topic was modified 2 years, 5 months ago by tornevall.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Roxy

    (@roxannestoltz)

    Hi @tornevall ,

    Thanks for reaching out!

    I run a test platform with WP 6.0, and when I disable all the plugins except WooCommerce, it also seem to work better.

    Just for clarity, have you enabled plugins, one by one, checking after each to see which plugin may be causing the issue? This would be the best way to determine which plugin is the possible culprit since the problem seems to resolve with all plugins disabled but is generally narrowed down to one.

    Additionally, please could you disable any caching plugins and clear your site and browser cache to see if this makes any difference?

    https://www.wpbeginner.com/beginners-guide/how-to-clear-your-cache-in-wordpress/

    Please let me know how this goes!

    Thread Starter tornevall

    (@tornevall)

    Yes, during tests woocommerce has been the only enabled plugin, without any caching, together with one other plugin that I’ve been working with for a long time (without changing any part that handles session related code).

    Currently I’m trying to figure out what makes the session invalid, together with the plugin we’re developing. We usually don’t handle sessions at all from the gateway plugin we’re testing (mostly since it tend to break others), and instead we let woocommerce handle those parts. The problems also seem to escalate in the most recent versions of woocommerce, but I can’t find out why. I tried some theories yesterday, but that did just slightly help to keep the session alive a bit longer. I’m not sure what can possible invalidate a session, when it’s only handled from woocommerce.

    Also, there’s no indication from error logs that code are breaking either.

    • This reply was modified 2 years, 5 months ago by tornevall.

    Hi @tornevall

    … if I roll back the woocommerce furthermore, the problem vanishes entirely. I run a test platform with WP 6.0, and when I disable all the plugins except WooCommerce, it also seem to work better.

    This seems to be happening due to partial/improper compatibility with one or more of the plugins present on your site. It could be the theme too.

    As Roxanne suggested above, we recommend performing a full conflict test to try and narrow down to the potential culprit, which is causing this to happen. This will involve deactivating all plugins apart from WooCommerce and switching to a default WP theme like Twenty Twenty-One or Storefront. Once done, reactivate the theme and other plugins, one by one, all along checking if the issue returns, to find the plugin (or the theme) that’s causing it.
    Here’s the conflict test guide for reference: https://docs.woocommerce.com/document/how-to-test-for-conflicts/

    Do let us know how it goes.

    Should further help be needed, please share with us the following:

    1. System Status: You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”. Once you’ve done that, paste it here in your response.
    2. Fatal Error Log: Share a copy of any fatal error log found under WooCommerce > System Status > Logs (if available).

    Hi @tornevall

    Can you please also get in touch with your host to see if there is any caching involved from the server? Please have them disable it, and then see if that solves the session expiration issue.

    Let us know how it goes.

    We haven’t heard back from you in a while, so I’m marking this thread closed for now – we’ll be here if and/or when you are ready to continue.

    Thread Starter tornevall

    (@tornevall)

    After a long investigation I’ve seen a few things that could affect the outcome of my problem. My intentions is not to reopen this case, but inform others with similar problems only.

    In my platform, the only thing I did have installed was WooCommerce and the only plugin we are developing for WooCommerce. Until 6.6.0 the problem was not there either. No cache and no other plugins was active at all. At first I believed that the problem was that related to my ip-network as I work locally (with two ipv6- and two ipv4-interfaces there’s a lot of jumps between the interfaces).

    With round robin set up in this format, cookies could be involved for when the outgoing ip addresses are switching, the cookie control also kills the session. This was never entirely confirmed; but the session in fact started to live a bit longer when I only used one ip address at the time. But it was still just about a few seconds longer.

    The second thing I actually did, was the most lazy thing I could come up with. Reinstall chrome instead of the site (based on incognito suggestions): The problems then seems to have disappeared since then, with only one strange condition. The problem partially came back for a couple of sessions when I cleaned up all cookies for the browser session and tried to start over with a “new” guest customer. By hard cleaning up all data for the site involved – not only a hard F5, but also really cleaning up the entire cache (included local storages) the problems again was gone.

    The problem itself remains unsolved, but something seem to happen with the session itself from time to time (and may eventually be related to WordPress rather than Woocommerce – this is also unclear) when “bad” data remains intact even after a hard reload.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Strange cookie/session expiration’ is closed to new replies.