Magento2: Unable to send the cookie. Size of 'mage-messages' is 13831 bytes in reports

Created on 25 Jan 2017  路  15Comments  路  Source: magento/magento2


Preconditions


  1. Magento CE 2.0.11

Steps to reproduce

  1. Login as customer
  2. Change email to an existing one of another customer
  3. Submit form

Expected result

  1. Should show an error message like 'Email already in use'

Actual result

  1. On production server: 503 error

Unable to send the cookie. Size of 'mage-messages' is 13831 bytes.

This limit is set in Magento\FrameworkStdlibCookie\PhpCookieManager::MAX_COOKIE_SIZE

  1. On developer mode: just page reload and no error message displayed for customer.

This error is caused by returned stack trace that is too large for the cookie limit (4096 bytes) in MagentoCustomerController\Account\EditPost::execute()

       try {
                $this->customerRepository->save($customerCandidateDataObject);
            } catch (AuthenticationException $e) {
                $this->messageManager->addError($e->getMessage());
            } catch (InputException $e) {
                $this->messageManager->addException($e, __('Invalid input'));
            } catch (\Exception $e) {
                $message = __('We can\'t save the customer.')
                    . $e->getMessage()
                    . '<pre>' . $e->getTraceAsString() . '</pre>';
                $this->messageManager->addException($e, $message);
            }
Customer Fixed in 2.1.x Fixed in 2.2.x Format is valid Ready for Work bug report

Most helpful comment

@developer-lindner As I can see 2.0.11 is the latest version from 2.0 branch. If u think that 2.1 is newer version of 2.0 u're in big mistake.

All 15 comments

@MTheProgrammer Magento CE 2.0.11 seriously? Update to latest version first than update or close this ticket. Creating tickets for an outdated version is very counterproductive.

@developer-lindner As I can see 2.0.11 is the latest version from 2.0 branch. If u think that 2.1 is newer version of 2.0 u're in big mistake.

Hi @MTheProgrammer thank for report
We've created internal ticket MAGETWO-63830 to address this issue.
Issue exist only in 2.0 versions You can try to update to 2.1 versions and the problem will be solved

Closing as the fix for this issue is already available on Magento 2.1.0 and 2.2.0 branches.

Backports to 2.0.x are not processed due to its End of Life in November.

@orlangur This happens in 2.2.8.

Magento\FrameworkStdlibCookieCookieSizeLimitReachedException: Noticed exception 'Magento\FrameworkStdlibCookieCookieSizeLimitReachedException' with message 'Unable to send the cookie. Size of 'mage-messages' is 6775 bytes.' in /var/www/magento2/vendor/magento/framework/Stdlib/Cookie/PhpCookieManager.php:215
in Magento\FrameworkStdlibCookie\PhpCookieManager::checkAbilityToSendCookie called at /var/www/magento2/vendor/magento/framework/Stdlib/Cookie/PhpCookieManager.php (139)
in Magento\FrameworkStdlibCookie\PhpCookieManager::setCookie called at /var/www/magento2/vendor/magento/framework/Stdlib/Cookie/PhpCookieManager.php (121)
in Magento\FrameworkStdlibCookie\PhpCookieManager::setPublicCookie called at /var/www/magento2/vendor/magento/framework/Interception/Interceptor.php (58)
in Magento\FrameworkStdlibCookie\PhpCookieManagerInterceptor::___callParent called at /var/www/magento2/vendor/magento/framework/Interception/Interceptor.php (138)
in Magento\FrameworkStdlibCookie\PhpCookieManagerInterceptor::Magento\FrameworkInterception{closure} called at /var/www/magento2/vendor/magento/framework/Interception/Interceptor.php (153)
in Magento\FrameworkStdlibCookie\PhpCookieManagerInterceptor::___callPlugins called at /var/www/magento2/generated/code/Magento/Framework/Stdlib/Cookie/PhpCookieManager/Interceptor.php (26)
in Magento\FrameworkStdlibCookie\PhpCookieManagerInterceptor::setPublicCookie called at /var/www/magento2/vendor/magento/module-theme/Controller/Result/MessagePlugin.php (140)
in MagentoThemeController\Result\MessagePlugin::setCookie called at /var/www/magento2/vendor/magento/module-theme/Controller/Result/MessagePlugin.php (95)
in MagentoThemeController\Result\MessagePlugin::afterRenderResult called at /var/www/magento2/vendor/magento/framework/Interception/Interceptor.php (146)
in Magento\FrameworkController\Result\RedirectInterceptor::Magento\FrameworkInterception{closure} called at /var/www/magento2/vendor/magento/framework/Interception/Interceptor.php (153)
in Magento\FrameworkController\Result\RedirectInterceptor::___callPlugins called at /var/www/magento2/generated/code/Magento/Framework/Controller/Result/Redirect/Interceptor.php (26)
in Magento\FrameworkController\Result\RedirectInterceptor::renderResult called at /var/www/magento2/vendor/magento/framework/App/Http.php (140)
in Magento\Framework\App\Http::launch called at /var/www/magento2/vendor/magento/framework/App/Bootstrap.php (257)
in Magento\Framework\App\Bootstrap::run called at /var/www/magento2/pub/index.php (37)

@valugi it shouldn't. Error message is logged but does not cause 503 error.

I am getting the same issue in 2.3.1, it is causing checkout to throw 503 error.

Any updates on this?

@kervin please report a new issue or reopen this one providing necessary details to reproduce.

Sorry, issue on our site.. Magento all good.

@kervin thanks for quick response. Sometimes it happens, no problem)

Sorry, issue on our site.. Magento all good.

@kervin , can you explain, what was your issue? We are facing the same on 2.3.2

It was a module throwing a large error message on add to cart.

An error message larger than the MAX_COOKIE_SIZE.

@kervin how did you debug that ? the logs don't help at all

Try to log the message / log back trace.. Then figure out which module is throwing this error.

It might be an observer on add to cart.

Was this page helpful?
0 / 5 - 0 ratings