Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-12828

submitting more than 20 tasks at once causes ERROR QuartzSchedulerThread - ThreadPool.runInThread() return false! for some tasks

    XMLWordPrintable

    Details

    • Story Points:
      3

      Description

      Submitting considerably more than 20 tasks at once causes a rejection error for some tasks. These tasks do not run, instead they hang in a "Waiting" state. You can see an error in the logs reported from quartz:

      2017-03-28 22:51:37,569+0200 ERROR [nexus_QuartzSchedulerThread] *SYSTEM org.quartz.core.QuartzSchedulerThread - ThreadPool.runInThread() return false!

      To reproduce, you can run the test here: https://github.com/sonatype/nexus-internal/pull/1671/files#diff-f47ab1796bb11e077d08f418a8fcf42e

      Changing the maximum tasks to 50 instead of 21.

      Also, you can use this groovy script to schedule a large number of tasks to run at once:

      import org.sonatype.nexus.scheduling.TaskConfiguration
      import org.sonatype.nexus.scheduling.TaskInfo
      import org.sonatype.nexus.scheduling.TaskScheduler
      
      import groovy.json.JsonOutput
      
      class TaskXO
      {
        String typeId
      
        Boolean enabled
      
        String name
      
        String alertEmail
      
        Map<String, String> properties
      }
      
      TaskScheduler scheduler = container.lookup(TaskScheduler.class.name)
      
      for (i = 0; i < 100; i++) {
        TaskXO task = new TaskXO(typeId: 'script', enabled: true, name: "Script$i", alertEmail: null,
            properties: [language: 'groovy', source: 'println \'sleeping\'\n' +
                'sleep(10000)\n' +
                'println \'slept\'']
        )
        println "Creating $i"
      
        TaskConfiguration config = scheduler.createTaskConfigurationInstance(task.typeId)
        config.enabled = task.enabled
        config.name = task.name
        config.alertEmail = task.alertEmail
        task.properties?.each { key, value -> config.setString(key, value) }
      
        //create to run every second
        TaskInfo taskInfo = scheduler.scheduleTask(config, scheduler.scheduleFactory.cron(new Date(), '59 * * * * ?'))
      
        //create to run every an hour from now
      //  TaskInfo taskInfo = scheduler.scheduleTask(config, scheduler.scheduleFactory.once(new Date(new Date().time + 3600000L)))
      
        JsonOutput.toJson(taskInfo)
      }
      

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mjohnson Matt Johnson
                Reporter:
                ecobb Eric Cobb
                Last Updated By:
                Peter Lynch
                Team:
                NXRM - Morpheus
              • Votes:
                2 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

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