Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-16111

Memory leak on custom Jobs if Id setted

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Invalid
    • Affects Version/s: 10.11.2
    • Fix Version/s: None
    • Component/s: Old Core, Refactoring
    • Labels:
    • Environment:
      tomcat 9
    • Difficulty:
      Hard
    • Similar issues:

      Description

      Hello,

      I have a very strange bug, I have some custom jobs run by my XWiki extension ( some are runs through an even listener, some others through a custom endpoint )

      But by default my jobs didn't have any ID ( null ), but now I want to give them some ID to be able to use

      `http://localhost:8080/xwiki/rest/jobstatus/myjob/myid?media=json`

      And actually it works well, I can access this URL and see that my jobs are finished, the very not fun fact is that even if everything seems finish, my thread is not killed, and the heap memory usage double and sometime just crash the JVM or made the wiki unusable.

      After a lot of minutes if it's not crash before, finally the memory is released sometime but not everytime.

       

      I can't join the memory dump rapport because it's far over 10mo.

       

      How to reproduce ? Honnestly it's difficult to give my code here, but If think just create an empty jobs ( which just say hello ) with an empty request ( with and without id )

       

      public class CustomRequest extends AbstractRequest
      Unknown macro: {     public CustomRequest(String jobType)     Unknown macro}
      }

       

      an empty job class

      @Component

      @Named(CustomJob.JOB_TYPE)

      public class CustomJob extends AbstractJob<CustomRequest, CustomJobStatus>
      Unknown macro: {     public static final String JOB_TYPE = "customJob";   // implement required metod ... }

       

      then just through for exemple an event listener or an endpoint ( CustomResource ) call

      this.jobExecutor.execute(CustomJob.JOB_TYPE, customRequest);

      Try it with and without setId in the request ( I use UUID.randomUUID but I also tried with the function provided by xwiki in RequestFactory.generateJobId(String type) it doesn't change anything

        this.setId(jobType+"/"+UUID.randomUUID().toString();

       

      It will maybe not be easy to reproduce it, I hope maybe you will see what is the issue

       

      thanks,

        Attachments

          Activity

            People

            • Assignee:
              tmortagne Thomas Mortagne
              Reporter:
              cracky5457 Axel
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Date of First Response: