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

(8.1) - WFLY-20773 Large batch repositories can create OutOfMemoryError's when reading the management model

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 8.0.z.GA
    • Batch
    • None
    • False
    • Hide

      None

      Show
      None
    • False
    • Hide

      Purge the number of jobs in the repository

      Show
      Purge the number of jobs in the repository
    • Hide

      Create a large repository or a larger repository on a server with limited memory. Then run the following CLI command on the deployment used to create the jobs in the repository:

      /deployment=*/:read-resource(recursive=true, include-runtime=true)
      
      Show
      Create a large repository or a larger repository on a server with limited memory. Then run the following CLI command on the deployment used to create the jobs in the repository: /deployment=*/:read-resource(recursive= true , include-runtime= true )

      The batch-jberet subsystem adds resources to a deployment for each job defined in a job XML file descriptor. If there are many descriptors or descriptors have a large quantity of job executions associated with them, reading the resource through a management operation may result in an OutOfMemoryError.

      The issue is caused by the org.wildfly.extension.batch.jberet.deployment.BatchJobExecutionResource which is registers each job execution for a given job. This method is the issue:

      /**
       * Note the access to the {@link #children} is <strong>not</strong> guarded here and needs to be externally
       * guarded.
       */
      private void refreshChildren() {
          if (System.currentTimeMillis() - lastRefreshedTime < refreshMinInterval) {
              return;
          }
      
          final List<Long> executionIds = jobOperator.getJobExecutionsByJob(jobName);
          final Set<String> asNames = executionIds.stream().map(Object::toString).collect(Collectors.toSet());
          children.clear();
          children.addAll(asNames);
          lastRefreshedTime = System.currentTimeMillis();
      }
      

      There is an attempt made not to refresh too fast introduced in WFLY-14275. However, this can still cause issues with very large repositories.

      A possible solution is to limit the number of jobs returned by the resource.

              jperkins-rhn James Perkins
              jperkins-rhn James Perkins
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: