We are encountering the below warnings in our logs:
WARN [nucleusNamespace.atg.dynamo.servlet.pagecompile.DAFDropletEventServlet] (ajp-0.0.0.0-8109-110) Added 29057 form elements to form /shop/wishList/viewWishList.jsp.addItemsToCart last element has name /project/commerce/wishlist/WishListFormHandler.wishItemValueObject.quantity.27025374. Form elements are registered permanently so if this table keeps growing, it is a memory leak. Recode your page to use consistent names for form elements.
WARN [nucleusNamespace.atg.dynamo.servlet.pagecompile.DAFDropletEventServlet] (ajp-0.0.0.0-8209-57) Added 21542 form elements to form /shop/wishList/viewWishList.jsp.addItemsToCart last element has name /project/commerce/wishlist/WishListFormHandler.wishItemValueObject.quantity.28506088. Form elements are registered permanently so if this table keeps growing, it is a memory leak. Recode your page to use consistent names for form elements.
DropletEventServlet keeps a map of form element names to the corresponding FormHandler Nucleus path and property name (partially as a security measure, to prevent a form submit from exposing unsafe, non-formhandler-ish properties). If one uses IDs in the form element names (and, by default, form element names are named from from FormHandler path and property name), this creates a memory leak over time as entries in DropletEventServlet build up with unique IDs that are unlikely to be ever used again.
One can avoid using IDs in form element names when dealing with multiple elements by instead using something like array of maps (be sure to implement the correct array Bean property accessor methods that will auto-allocate an array as needed). For example, one might use properties "MyFormHandler.itemMapArray.id" and "MyFormHandler.itemMapArray.quantity". One could also use parallel arrays: "MyFormHandler.itemIds" and "MyFormHandler.quantities".
I have the following doubts:
1)The form handlers used in this particlular code are having session scope. So shouldn't these references be cleared when the session expires?
2) How can this be handled in case components like the /atg/commerce/order/purchase/CartModifierFormHandler.items.catalogRefId which is provided by ATG itself?
After you get the memory leak warning, look at DropletEventServlet in /dyn/admin's component browser, and you can see the buildup of form element mappings for the page in question. DropletEventServlet is a globally scoped component (regardless of the scope of the form handlers it tracks), and does not remove entries over time (which is why it's important not to use IDs in FormHandler form element maps, and why it issues a warning once you at 500 for a form).
My guess is that the bug you are seeing is a fixed CSC bug that's been fixed in newer versions of ATG (2007.1 and later). You might want to check a newer versions of ATG to see if the form is still coded in the same way.