Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-19407

[GSS](7.3.z) Memory leak in FlashScope - expired elements are not cleared

    XMLWordPrintable

    Details

    • Target Release:
    • Steps to Reproduce:
      Hide

      1. Deploy the attached reproducer.
      2. Press "Accumulate 100MB in FlashScope" button several times, then, OOMError will occur.

      Show
      1. Deploy the attached reproducer. 2. Press "Accumulate 100MB in FlashScope" button several times, then, OOMError will occur.
    • Workaround Description:
      Hide
      • Using SessionScope instead of FlashScope for POST-REDIRECT-GET.
      • Set com.sun.faces.numberOfConcerrentFlashUsers and com.sun.faces.numberOfFlashesBetweenFlashReapings to web.xml as following
        <context-param>
            <param-name>com.sun.faces.numberOfConcerrentFlashUsers</param-name>
            <param-value>10</param-value>
        </context-param>
        <context-param>
            <param-name>com.sun.faces.numberOfFlashesBetweenFlashReapings</param-name>
            <param-value>1</param-value>
        </context-param>
        
      Show
      Using SessionScope instead of FlashScope for POST-REDIRECT-GET. Set com.sun.faces.numberOfConcerrentFlashUsers and com.sun.faces.numberOfFlashesBetweenFlashReapings to web.xml as following <context-param> <param-name> com.sun.faces.numberOfConcerrentFlashUsers </param-name> <param-value> 10 </param-value> </context-param> <context-param> <param-name> com.sun.faces.numberOfFlashesBetweenFlashReapings </param-name> <param-value> 1 </param-value> </context-param>
    • QE Test Coverage:
      +

      Description

      This is a regression agains the 7.2.z stream.

      Objects in FlashScope is not cleared and keep accumulating even if POST-REDIRECT-BACK is completed.

      If we put a huge object to FlashScope continuously as the following code, Java heap space will be exhausted soon.

      @Model
      public class Action {
      
          private static final int oneHundredMB = 1024 * 1024 * 100;
      
          public String next() {
              Flash flash = FacesContext.getCurrentInstance().getExternalContext().getFlash();
              flash.putNow("huge", new byte[oneHundredMB]);
              return "index.xhtml?faces-redirect=true";
          }
      }
      

      When OutOfMemoryError is happened, flashInnerMap field in com.sun.faces.context.flash.ELFlash is bloated.

      Class Name                                                             | Ref. Objects | Shallow Heap | Ref. Shallow Heap | Retained Heap
      -----------------------------------------------------------------------------------------------------------------------------------------
      java.lang.Thread @ 0xeea24380  default task-1 Thread                   |            1 |          120 |                64 |        20,800
      '- <Java Local> com.sun.faces.context.flash.ELFlash @ 0xee9e4608       |            1 |           40 |                64 |            64
         '- flashInnerMap java.util.concurrent.ConcurrentHashMap @ 0xee9e4630|            1 |           64 |                64 |   314,574,048
      -----------------------------------------------------------------------------------------------------------------------------------------
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              spyrkob Bartosz Spyrko-Smietanko
              Reporter:
              pmackay Peter Mackay
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: