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

(7.3.z) Memory leak caused by org.eclipse.yasson.internal.JsonBinding

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.3.5.GA, 7.3.5.CR1
    • None
    • REST
    • None

      org.eclipse.yasson.internal.JsonBinding keeps a reference on an enum after the war is undeployed which results in a classloader leak.

      1- Deploy the following application:
       

      package au.com.spatiumxl.model;
      
      public class Book {
      
          public enum Status { READ, UNREAD }
      
          private String title; 
          private Book.Status status;  
      
          public Book(String title) {  
              this.title = title; 
              this.status = Book.Status.UNREAD; 
          }
      
          public String getTitle() {  
              return title; 
          }
      
          public Book.Status getStatus() { 
              return status; 
          }
      }
      

       

      package au.com.spatiumxl.ejb;
      
      [...]
      
      import au.com.spatiumxl.model.Book;
      
      @Stateless
      @LocalBean
      public class BookService {
      
          public List<Book> getBooks() {  
              List<Book> books = new ArrayList<>();
              books.add(new Book("title1"));  
              return books; 
          }
      }
      

       

      package au.com.spatiumxl.rest;
      
      [...]
      
      import au.com.spatiumxl.ejb.BookService;
      import au.com.spatiumxl.model.Book;
      
      @RequestScoped
      @Path("")public 
      class BookEndPoint {  
      
          @Inject BookService bookService;  
      
          @GET @Path("/get-books") 
          @Produces("application/json") 
          public List<Book> getBooks() {  
              return bookService.getBooks(); 
          }
      }
      

       

      2- On the browser go to: http://<host>/<context-root>/.../get-books

      3- Undeploy the war

      4- The memory analyser shows:

      java.lang.Thread
       org.jboss.modules.ModuleClassLoader
        org.jboss.modules.Module
         org.jboss.modules.LocalModuleLoader
          java.util.concurrent.ConcurrentHashMap
           java.util.concurrent.ConcurrentHashMap$Node[]
            java.util.concurrent.ConcurrentHashMap$Node
             org.jboss.modules.ModuleLoader$FutureModule
              org.jboss.modules.Module
               org.jboss.modules.ModuleClassLoader
                java.util.Vector
                 java.lang.Object[]
                  org.jboss.resteasy.plugins.providers.jsonb.AbstractJsonBindingProvider
                   org.eclipse.yasson.internal.JsonBinding
                    org.eclipse.yasson.internal.JsonbContext
                     org.eclipse.yasson.internal.MappingContext
                      java.util.concurrent.ConcurrentHashMap
                       java.util.concurrent.ConcurrentHashMap$Node[]
                        java.util.concurrent.ConcurrentHashMap$Node
                         org.eclipse.yasson.internal.model.ClassModel
                          org.eclipse.yasson.internal.model.PropertyModel[]
                           org.eclipse.yasson.internal.model.PropertyModel
                            au.com.spatiumxl.model.Book$Status
      

              rhn-engineering-lgao Lin Gao
              rhn-engineering-lgao Lin Gao
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: