Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-50111

ImageToolImpl.read() may cause "Too many open files"

    Details

      Description

      In same rare cases the issue is reproducible in the following way:

      1) Have image.auto.scale=true in portal-ext.
      2) Change the picture of a the default user, note it's dimensions (mine is a 100x100 Metallica album cover)
      3) Access the picture a couple of times by using the following link and specify scaling dimensions so that both height < 100 and width < 100.

      http://localhost:9080/image/user_male_portrait?img_id=10705&height=90&width=90&img_id_token=Wjb%2BVNgWfrHFgitX0CgxhfM1OdY%3D&t=1410853674423

      4) Observe open files (I had 70 imageio*.tmp files open)

      % lsof -a -p <pid> +D tomcat-7.0.34/temp -Fn | grep "^n.*imageio.*\.tmp" | wc -l
      70
      

      5) Trigger GC with JVisualVM and recheck

      % lsof -a -p <pid> +D tomcat-7.0.34/temp -Fn | grep "^n.*imageio.*\.tmp" | wc -l
      0
      

      This isn't really a bug, but rather a system configuration issue, probably with enough open files allowed amd tuned GC settings it wouldn't occur.

      Notes for QA

      • Reproducible on 6.2 SP5 and onwards or when platform-16-6210 is installed.
      • On Windows in place of LSOF, Process Explorer can be used.
      • <pid> is the process ID of Liferay's JVM, you can get <pid> with JPS:
      % jps -lvm | grep liferay-portal
      25075 org.apache.catalina.startup.Bootstrap start -Djava.util.logging.config.file=/home/lcsontos/liferay/bundles/liferay-portal-6.1.30-ee-ga3/tomcat-7.0.40/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Dfile.encoding=UTF8 -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -XX:NewSize=256m -XX:MaxNewSize=512m -Xms1024m -Xmx2048m -XX:MaxPermSize=512m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=20 -XX:ParallelGCThreads=2 -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/lcsontos/liferay/bundles/liferay-portal-6.1.30-ee-ga3/tomcat-7.0.40/logs -Xloggc:/home/lcsontos/liferay/bundles/liferay-portal-6.1.30-ee-ga3/tomcat-7.0.40/logs/gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Djava.endorsed.dirs=/home/lcsontos/liferay/bundles/liferay-portal-6.1.30-ee-ga3/to
      
      • The fix is effective, if in step (4) you can see zero imageio*.tmp files.

        Attachments

        1. fixed.png
          fixed.png
          7 kB
        2. reproduced.png
          reproduced.png
          7 kB

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  4 years, 45 weeks, 5 days ago

                  Packages

                  Version Package
                  6.2.3 CE GA4
                  6.2.X EE
                  7.0.0 M2