3 Replies Latest reply on May 10, 2007 7:10 PM by Alexander Smirnov

    Memory Leak During Resources Encryption/Deflation (org.ajax4

    Gregory Chomatas Newbie

      Hi,
      Two weeks ago we added RichFaces (3.0.1) and Ajax4JSF(1.1.1) to our web application (E-goverment CRM).
      We were very excited with the functionality of the components and the nice skins.
      However after deployment to the production system (Redhat Enterprise 4, 4 CPUs, 6G mem, ~50-60 concurrent users) we encountered severe memory leaks. The system was crashing every 5 minutes and we decided to replace the web app with a previous version until we discover the memory leak cause.

      The leak was not at the Heap but rather at the memory used by the JVM process itself. I other words the Heap was always around 40-60% of the max allocated while the Memory footprint of the JVM process (i.e. the commited virtual space) was increasing in tenths of Megabytes every 5-10 seconds. In minutes it was reaching the 4G process limit (Redhat HugeMem Kernel, 32 bit machine) and we were getting the crash.

      After profiling and log examination we found that the problem might be at the encrypt method of the org.ajax4jsf.framework.resource.ResourceBuilderImp class.
      More specifically, it seems that a compressor.end() is missing in order to free the resources that the compressor allocates. These resources are allocated in the JVM Process memory and not at Heap and thus they are not Garbage collected unless the compressor.end() is used. In the decrypt() method the decompressor.end() is NOT missing.

      We patched the class and we deployed the web app at the Production System again. After 3 days of full use it seems that everything is OK now. No leaks at all. The JVM process footprint does not grow at all anymore.
      Maybe you should check if what we discovered is valid (as it seems) and patch the Ajax4JSF jar.

      Kind Regards
      Gregory Chomatas