Skip to content
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

Scheduling a task that runs once a day results in March 28 being skipped #26744

Closed
AlexCovizzi opened this issue Mar 30, 2021 · 2 comments
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@AlexCovizzi
Copy link

Affects: Spring Framework 5.3.1


Problem: Scheduled task marked with the annotation @Scheduled(cron = ""0 0 9 * * *"", zone = "Europe/Amsterdam") did not run on March 28

Expected behaviour: The scheduled task should have run on March 28

How to reproduce: The bug seems to be related to the class CronExpression introduced in version 5.3

ZonedDateTime current = ZonedDateTime.of(LocalDateTime.parse("2021-03-27T09:00:00"), ZoneId.of("Europe/Amsterdam"));
CronExpression cronExpression = CronExpression.parse("0 0 9 * * *");
ZonedDateTime next = cronExpression.next(current);

In this case the value returned by cronExpression.next() is 2021-03-29T09:00:00 instead of the expected 2021-03-28T09:00:00

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 30, 2021
@poutsma poutsma self-assigned this Mar 30, 2021
@poutsma poutsma added in: core Issues in core modules (aop, beans, core, context, expression) type: regression A bug that is also a regression type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on type: regression A bug that is also a regression labels Mar 30, 2021
@poutsma poutsma added this to the 5.3.6 milestone Mar 30, 2021
@poutsma poutsma reopened this Mar 30, 2021
Zoran0104 pushed a commit to Zoran0104/spring-framework that referenced this issue Aug 20, 2021
This commit fixes an issue with CronExpression when used in combination
with ZonedDateTime and daylight saving time.

Closes spring-projectsgh-26744
Zoran0104 pushed a commit to Zoran0104/spring-framework that referenced this issue Aug 20, 2021
@guilroux
Copy link

Hello,

Looks like there is still a problem for the following case :
ZonedDateTime current = ZonedDateTime.of(LocalDateTime.parse("2021-03-28T00:31:00"), ZoneId.of("Europe/Amsterdam")); CronExpression cronExpression = CronExpression.parse("0 5 0 * * *"); ZonedDateTime next = cronExpression.next(current);

In this case the value returned by cronExpression.next() is 2021-03-30T00:05 instead of the expected 2021-03-29T00:05

@sbrannen
Copy link
Member

@guilroux, please do not comment on closed tickets.

If you believe you have discovered a bug, please open a new ticket to report it.

Thanks

lxbzmy pushed a commit to lxbzmy/spring-framework that referenced this issue Mar 26, 2022
This commit fixes an issue with CronExpression when used in combination
with ZonedDateTime and daylight saving time.

Closes spring-projectsgh-26744
lxbzmy pushed a commit to lxbzmy/spring-framework that referenced this issue Mar 26, 2022
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) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

5 participants