Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-3197

Memory leak detected in org.apache.struts.tiles.xmlDefinition.I18nFactorySet

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.1.1, 1.3.8
    • None
    • Tiles 1 Plugin
    • None
    • AIX, Windows, WebSphere 6.1, DB2 9.5
    • Patch

    Description

      During performance testing we discovered an Out of Memory exception. While looking into the heap dump produced, I detected two separate tiles objects (namely org.apache.struts.tiles.xmlDefinition.XmlParser and org.apache.struts.tiles.xmlDefinition.DefinitionsFactory) which combined were consuming 285 meg (we have a lot of tiles definitions). After further analysis of the code in org.apache.struts.tiles.xmlDefinition.I18nFactorySet, I discovered that for each tile config file being processed by org.apache.struts.tiles.xmlDefinition.I18nFactorySet.parseXmlFile(ServletContext servletContext, String filename, XmlDefinitionsSet xmlDefinitions) was creating a new XmlParser() to parse the tiles config file and put into an XmlDefinitionsSet. The new XmlDefinitionsSet is ultimately used to construct org.apache.struts.tiles.xmlDefinition.DefinitionsFactory. After the last file is processed the XmlParser is kept in memory and no longer performs the necessary function after initializing Tiles is complete. The underlying SAXParser and other objects are still there consuming resources.

      I removed the following code from org.apache.struts.tiles.xmlDefinition.I18nFactorySet.

      /**

      • XML parser used.
      • Attribute is transient to allow serialization. In this implementaiton,
      • xmlParser is created each time we need it ;-(.
        */
        protected transient XmlParser xmlParser;

      And changed the following in the method parseXmlFile( ServletContext servletContext, String filename, XmlDefinitionsSet xmlDefinitions)

      I've included a patch file with changes also.

      Attachments

        Activity

          People

            Unassigned Unassigned
            dabeita David Abeita
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: