Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 3.3.0, 3.12.0, 3.12.1, 3.13.0
-
Fix Version/s: 3.15.0
-
Component/s: Scheduled Tasks
-
Labels:
-
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
- discovered while testing
-
NEXUS-12780 task scheduler threads may deadlock at QuartzTaskJob.mayBlock() when more than 20 blocking tasks are encountered
-
- Closed
-
- relates
-
NEXUS-13121 tasks may appear as Starting or Cancelling indefinitely and cannot be stopped cancelled or deleted
-
- Closed
-