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

Documents and Media is leaking memory (java.io.File.deleteOnExit() causes) when repository is inside Oracle DB

    Details

      Description

      issue

      java.io.DeleteOnExitHook will cause memory leak. Please refer to

      https://bugs.java.com/view_bug.do?bug_id=4872014

      https://issues.liferay.com/browse/LPS-22268

      Steps to reproduce

      1. Enable DBStore setting in portal-ext.properties
        (dl.store.impl=com.liferay.portal.store.db.DBStore)
      2. Connect it to an empty Oracle database
      3. Start liferay
      4. Add the "Documents and Media" portlet into the home page
      5. Go to "Liferay DXP Site > Content > Documents and Media"
      6. From Terminal, get one heap dump
        https://customer.liferay.com/documentation/knowledge-base/-/kb/12529
        (windows: jmap -dump:format=b,file=heapdump.hprof <pid>)
      7. Upload several image files into Documents and Media
      8. Go back to the home page and confirm uploaded files are displayed
      9. From Terminal, get another heap dump
      10. Run "Eclipse Memory Analyzer" and open the heap dumps
      11. Click on "Histogram" button
      12. In Class Name column's Regex, filter with "LinkedHashSet"
      13. Note 1 record will show
      14. Right-click on it and select "Search Queries..."
      15. Type "hash_" and double-click on "Hash Entries"
      16. Leave all defaults and click Finish
      17. On Key column's Regex, filter by "liferay-dxp" (liferay-dxp is your liferay-home folder name)
      18. Note the Key value belongs to temporary files (for example, D:\liferay_home\tomcat-9.0.6\temp\20180418021641041KOPOJNRH).
      19. Confirm the number of resulted entries grows from dump1 to dump2
      20. Upload more images, display them and take heap dump again to see it keeps increasing

      Actual results
      LinkedHashSet keeps growing, leaking memory and potentially leading to OutOfMemory error.

      Expected results

      LinkedHashSet doesn't include the temp files value.

       

        Attachments

          Activity

            People

            Assignee:
            abel.yu Abel Yu (Inactive)
            Reporter:
            hai.yu Hai Yu
            Participants of an Issue:
            Recent user:
            Brian Wulbern
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              3 years, 7 weeks, 3 days ago

                Packages

                Version Package
                7.0.0 DXP FP47
                7.0.0 DXP SP8
                7.0.X
                7.1.0 Beta 1
                7.1.10 DXP FP5
                7.1.10.1 SP1
                7.1.2 CE GA3
                7.1.X
                Master