Skip to content

Incorrect message: Unable to send the cookie. Maximum number of cookies would be exceeded #17195

Closed
@ihor-sviziev

Description

@ihor-sviziev

Previously this issue was reported in #7931 and #16568, but no one was able to reproduce it.

Preconditions

  1. Magento 2.2.5 installed via composer

Steps to reproduce

  1. Open desktop browser Firefox
  2. Navigate to about:config
  3. Find "dom.storage.enabled" option and change to "false"
  4. Navigate to Magento 2.2.5 (frontend), open developer tools >> Storage >> Cookies and look at list (there are 33 cookies)
    image
  5. Duplicate tab (open the same page in another page) - you will have 43 cookies.
    image
  6. Try to duplicate tab again - you will have 52 cookies.
    image

Expected result

  1. Cookies list should not grow such fast

Actual result

  1. We can take more then 50 cookies that leads to exception that described in Unable to send the cookie. Maximum number of cookies would be exceeded #7931 and local/session storage is mismanaged, particularly when it doesn't exist #16568

Tech note

I investigated issue described in #16568 and found that we have 2 different polyfill implementaions for localStorage and sessionStorage:

  1. Added to page html (https://github.com/magento/magento2/blob/2.2-develop/app/code/Magento/Theme/view/frontend/templates/js/polyfill.phtml)
  2. As part of jquery.storageapi library - https://github.com/magento/magento2/blob/2.2-develop/lib/web/jquery/jquery.storageapi.min.js

These implementation are fully different. 1st one works good, but 2nd one adds strange behavior - adds separate cookie with ls_ prefix in name for each item that should be stored in localstorage and ss_<some_id>_ for session storage. As result - when customer goes through website - it will add new and new cookies (because of this strange ss_<some_id>_ prefix).

Sometimess, we're having 2nd implementation used instead of 1st one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: ThemeFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseSeverity: S4Affects aesthetics, professional look and feel, “quality” or “usability”.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions