Issue Bug Closed

#79175AjaxWidgetContextHolder pollutes session data

Dirk Wenzel 01/05/17, 22:17 updated 12/17/21, 14:23

Description

**Summary**
Ajax widgets do pollute the session data by storing their configuration on each page reload under a new identifier. Finally the session data grows too big to get loaded from the database.

Steps to reproduce
  • insert any Ajax widget into a page (e.g. f:widget.autocomplete)
  • reload the page a few times
  • watch the session data entry of the current user grow
SELECT hash, tstamp, LENGTH(content) FROM fe_session_data;

(tested under current versions of 6.2 and 7.6)

**Findings**
Any Ajax enabled widget instance restores its widgets context via an instance of AjaxWidgetContextHolder.
This class stores the content of its $widgetContext property to either the FE or BE user session under the key TYPO3\\CMS\\Fluid\\Core\\Widget\\AjaxWidgetContextHolder_widgetContexts (see method storeWidgetContexts()).
In the constructor the content of this key is restored into the property $widgetContext.

On each call of the method store() a new unique ajaxWidgetId is generated and the configuration of the widget is added to the $widgetContext array.
This behaviour leads to a constantly growing size of the session data. It is only interrupted if the user session invalidates (by expiration or deleting the fe_user_session cookie).

**Conclusion**
I’m not sure about the expected behaviour.
There seems to be a conceptual fault though: Since the page content with the widget will most probably be cached, only the first entry of the $widgetContext array will be used as argument fluid-widget-id for the widget action link.

Any suggestions are welcome.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.