This discussion is archived
3 Replies Latest reply: Feb 12, 2013 3:18 PM by cmore RSS

memory leak warnings for elements in a form

989777 Newbie
Currently Being Moderated
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.

Thanks

Edited by: 986774 on Feb 7, 2013 5:39 AM
  • 1. Re: memory leak warnings for elements in a form
    cmore Explorer
    Currently Being Moderated
    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[0].id" and "MyFormHandler.itemMapArray[0].quantity". One could also use parallel arrays: "MyFormHandler.itemIds[0]" and "MyFormHandler.quantities[0]".
  • 2. Re: memory leak warnings for elements in a form
    989777 Newbie
    Currently Being Moderated
    Thanks for the reply.

    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[0].catalogRefId which is provided by ATG itself?

    Thanks

    Edited by: 986774 on Feb 12, 2013 3:47 AM
  • 3. Re: memory leak warnings for elements in a form
    cmore Explorer
    Currently Being Moderated
    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.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points