Magento 2.3.2 Redis Session Error – Successfully Broke Lock Fix

magento2.3.2redissession

I am using Redis to store sessions and getting the error:

[2019-11-26 09:51:32] main.INFO: ip-10-0-0-78|28852: Successfully broke lock for ID sess_ebfc12b22fa8c8e1fb81dca122fcdda6 after 5.01422 seconds (10 attempts). Lock: 12
Last request of broken lock: POST pp-www.revivermx.com/rest/default/V1/carts/mine/payment-information /customer/section/load/?sections=messages&force_new_section_timestamp=true&_=1574761818952 [] []
[2019-11-26 09:51:37] main.WARNING: ip-10-0-0-78|28670: Did not write session for ID ebfc12b22fa8c8e1fb81dca122fcdda6: another process took the lock. /rest/default/V1/carts/mine/payment-information [] []

I have tried everything and also tried with updating max_concurrency values as well. But still facing issues.

In actual, while I am placing the order, then randomly I am getting redirected to Shopping Cart page (Empty Shopping Cart) after order is placed. Sometimes, it shows the Success page but most of the time redirects to the Shopping Cart page. Although orders are getting placed successfully.

After debugging, I found out that the session got invalidated before the rendering the Success page. Any help would be appreciated.

Redis configurations:

 'session' => [
   'save' => 'redis',
   'redis' => [
        'host' => 'redis',
        'port' => '6380',
        'password' => '',
        'timeout' => '2.5',
        'persistent_identifier' => '',
        'database' => '0',
        'compression_threshold' => '2048',
        'compression_library' => 'gzip',
        'log_level' => '1',
        'max_concurrency' => '12',
        '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'
    ]
],

Best Answer

Finally able to resolve this issue by changing below configurations for Redis:

  1. break_after_frontend changed from 5 to 30
  2. max_concurrency => changed from 6 to 25

break_after_frontend was the main culprit. Following error log helped to trace the issue.

[2019-11-26 09:51:32] main.INFO: ip-10-0-0-78|28852: Successfully broke lock for ID sess_ebfc12b22fa8c8e1fb81dca122fcdda6 after 5.01422 seconds (10 attempts). Lock: 12
Last request of broken lock: POST pp-www.revivermx.com/rest/default/V1/carts/mine/payment-information /customer/section/load/?sections=messages&force_new_section_timestamp=true&_=1574761818952 [] []
[2019-11-26 09:51:37] main.WARNING: ip-10-0-0-78|28670: Did not write session for ID ebfc12b22fa8c8e1fb81dca122fcdda6: another process took the lock. /rest/default/V1/carts/mine/payment-information [] []
Related Topic