-
Notifications
You must be signed in to change notification settings - Fork 38.5k
waitForTasksToCompleteOnShutdown has no effect on tasks created with @Scheduled annotation #26482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: duplicate
A duplicate of another issue
Comments
spring-boot PR related to the issue: spring-projects/spring-boot#15951 |
Related yes, but doesn't fix this issue - that PR was included in the releases where I've seen this behaviour. |
savinov
added a commit
to savinov/spring-framework
that referenced
this issue
Sep 14, 2022
1. build.gradle: comment io.spring.gradle-enterprise-conventions plugin 2. gradle.properties: set version=5.2.8.RELEASE-SHUTDOWN 3. ScheduledTaskRegistrar: shutdown taskScheduler in destroy() 4. ScheduledAnnotationBeanPostProcessor: do not cancel tasks in destroy()
savinov
added a commit
to savinov/spring-framework
that referenced
this issue
Sep 14, 2022
…nShutdown is true 1. ScheduledTaskRegistrar: shutdown taskScheduler of ExecutorConfigurationSupport type in destroy() 2. ScheduledAnnotationBeanPostProcessor: do not cancel tasks in destroy(), taskRegistrar cancel them Closes spring-projectsgh-26482
This effectively duplicates #31019 and should therefore be addressed as of 6.0.12 / 5.3.30. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: duplicate
A duplicate of another issue
Affects: 2.4.2 (and likely several previous releases)
Steps to reproduce:
@EnableScheduling
at application class@Scheduled
method withThread.sleep(60000)
spring.task.scheduling.shutdown.await-termination=true
in application.propertiesExpected Behavior
The task should not be interrupted, since
spring.task.scheduling.shutdown.await-termination
setswaitForTasksToCompleteOnShutdown
totrue
on the TaskScheduler.Actual Behavior
The task is interrupted the InterruptetException is logged.
More Details
scheduler.scheduleWithFixedDelay()
, everything works as expected.@Scheduled
task is interrupted byScheduledAnnotationBeanPostProcessor.destroy()
@Scheduled
-Annotation. So IMHO it should either be fixed or documented.@Async
: if I create an@Async
method and let it sleep for 60000ms while havingspring.task.execution.shutdown.await-termination=true
, everythinq works as expected: The async task is not interrupted on shutdown.Note: When I say "shutdown" I mean to stop the application in Spring Tool Suite. In the log I see "Application shutdown requested.", so I assume I am testing an orderly shutdown here and not some corner case.
The text was updated successfully, but these errors were encountered: