Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running Magento and have noticed strange behavior with the adminhtml/session messaging system:

Mage::getSingleton('adminhtml/session')->addSuccess("Message"); //or addError();

If you have two pages open in the backend and page 1 calls this function, upon refreshing page 2 (granted that this is done prior to page 1 completing it's refresh), the message will be rendered on page 2.

How to reproduce:

  1. Refresh all caches (SystemCache ManagementSelect AllRefresh
  2. Immediately open Magento's order page (SalesOrders)

You'll now notice that the Orders page has the success message rendered, something along the lines of:

9 cache type(s) refreshed.

See the image below where this message is rendered on the Orders page

enter image description here

Has anybody else experienced this behavior? I'm trying to establish whether this is brought about by my specific instance of Magento as a result of third party extensions or whether it exists in Magento's core.

If the latter, does anybody perhaps know of a fix for this? I know it may not seem very high priority, but there are instances where this behavior could be detrimental to site functionality.

share|improve this question
up vote 4 down vote accepted

This is somehow a feature. Here is how addError, addSuccess, addNotice, addWarning work.
The message you give as a parameter for those methods are added to the session.
when a page is viewed, Magento checks in the session for any messages.
If there are any, they are displayed and removed from the session.

So when you do an action (like refreshing cache types for example) and the action is finished, but the redirect is not complete, it means you will have the messages in the session already and refreshing any other page will display them and remove them from session.

I don't think there is a way to "fix" this. This also happens on frontend if you move fast enough.

share|improve this answer
Thanks. I also realized that when creating an order, a success message is sent to the session for sales_order view giving you a success message, so 'fixing' it would probably be a bad idea. – moose Mar 12 '14 at 8:52

I can't imagen where this behaviour is a problem. But beside of this, this behaviour can only be fixed if you use two different sessions. The errors are saved to the session and are shown the next time, the message block is loaded.

You can fix this only on your side, e.g using more than one browser.

share|improve this answer
Thanks @Fabian Blechschmidt, it's not a major issue but if (for example) you call a function via AJAX which (for instance) sends an email to a customer. An error could be encountered if the mail server is not responsive and the error would be loaded into the session. However, because this is called by AJAX, the page won't reload and as a result you won't immediately see the error message. But yeah, as I mentioned, not THAT much of an issue. Will upvote as soon as I can, reached the limit today. – moose Mar 12 '14 at 8:52
If you call something via ajax, you should handle this ;-) – Fabian Blechschmidt Mar 12 '14 at 8:55
One instance where this can be an issue is when you have some poorly coded pages, specifically templates, which don't check (and clear) the message buffer. Browsing away from the page would result in the message for the previous page, appearing. This can confuse some users. This behaviour could be fixed by associating messages in the buffer with their respective controllers/actions. – ProxiBlue Dec 14 '15 at 14:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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