We have a backend observer that sets a session variable after a shipment is created (sales_order_shipment_save_commit_after).

It's been working for over 2 years, but after the latest upgrade to 2.4.3-p1, the session parameter is not being updated. The issue is also present if we use the raw $_SESSION variable instead of Magento's preferred mechanism. It's as if the session has already been closed by the time the observer is executed.

For completeness, here's the code. It's nothing complicated.



  namespace [CompanyName]\[ModuleName]\Observer;
  use Magento\Framework\Event\ObserverInterface;

  class SaveShipmentAfter implements ObserverInterface {

    private $_backendSession;

    public function __construct(
      \Magento\Backend\Model\Session $backendSession
    ) {
      $this->_backendSession = $backendSession;

    public function execute(\Magento\Framework\Event\Observer $observer) {
      $shipmentId = $observer->getShipment()->getId();
      $this->_backendSession->setData('shipment_created_id', $shipmentId);

My question is - should sessions not be used this way in observers (and Magento is finally enforcing that)? is it a bug in the newest release, or is there a new way to utilise sessions?

1 Answer 1


After wasting a combined 10 hours on this issue, it turns a "max session size" setting has been added deep down in the store configuration:

Stores > Configuration > Advanced > System > Security > Max Session Size in Admin

This isn't mentioned as a potential breaking change in the release notes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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