Skip to content

Conversation

@rdingwall
Copy link

@rdingwall rdingwall commented Mar 12, 2025

We're investigating a production bug at Monzo where a 2:00 AM US/Pacific cron was skipped on 2025-03-09. We discovered the root cause is the https://github.com/robfig/cron library skips jobs that are scheduled during the interval when time jumps forward due to DST changes.

It seems the library's behavior is a bit non-standard in this regard, and differs from ISC cron which is used in most distributions of Linux and BSDs:

https://man7.org/linux/man-pages/man8/cron.8.html

If time was adjusted one hour forward, those jobs that would have run in the interval that has been skipped will be run immediately.

This PR aligns the behavior of the library with ISC cron.

@rdingwall rdingwall force-pushed the prevent-skipped-crons-when-time-jumps-forward-due-to-dst branch from c85f2a7 to 0336bd2 Compare March 12, 2025 02:16
@rdingwall rdingwall force-pushed the prevent-skipped-crons-when-time-jumps-forward-due-to-dst branch from 0336bd2 to 59f645e Compare March 12, 2025 02:35
CybotTM added a commit to netresearch/go-cron that referenced this pull request Nov 25, 2025
When time jumps forward due to DST (e.g., 2am→3am), jobs scheduled
during the skipped hour now run immediately at the next valid time
instead of being skipped entirely.

This follows ISC cron behavior and fixes common user expectations.
Based on robfig/cron PR robfig#541.
CybotTM added a commit to netresearch/go-cron that referenced this pull request Nov 25, 2025
- Update badges and import paths for the fork
- Document panic fixes (issues robfig#554, robfig#555, robfig#551)
- Document DST handling improvements (PR robfig#541)
- Update Go version requirement to 1.25
- Simplify and modernize documentation structure
CybotTM added a commit to netresearch/go-cron that referenced this pull request Nov 25, 2025
Modernize the robfig/cron fork with critical bug fixes and improvements.

## Bug Fixes
- Fix TZ timezone parsing panic when spec has no fields after TZ prefix (robfig#554, robfig#555)
- Fix nil pointer panic in Entry.Run() when WrappedJob is nil (robfig#551)

## Enhancements
- Implement ISC cron DST behavior for spring forward (robfig#541)
- Upgrade to Go 1.25
- Finalize module path as github.com/netresearch/go-cron

## CI/Quality
- Add comprehensive GitHub Actions CI workflow
- Add golangci-lint v2 configuration
- Add Dependabot for dependency updates
- Fix deprecated io/ioutil usage

## Documentation
- Update README for fork with migration instructions
- Document all fixes and improvements

All tests pass. Successfully integrated into Ofelia with full test coverage.
CybotTM added a commit to netresearch/go-cron that referenced this pull request Nov 28, 2025
Create docs/MIGRATION.md with detailed migration documentation:

- Quick start section with import path and go.mod changes
- Go version requirements comparison
- Behavioral differences with before/after examples:
  - TZ= parsing panic fixes (robfig#554, robfig#555)
  - Entry.Run() chain behavior fix (robfig#551)
  - DST spring-forward handling (robfig#541)
  - Step range validation (robfig#543)
  - Input length limits
- Type changes (EntryID: int -> uint64)
- New features overview (FakeClock, StopAndWait, Timeout, heap scheduling)
- Migration checklist
- Testing recommendations with code examples
- Troubleshooting section

Also update README.md to link to the comprehensive migration guide.

Closes #73
CybotTM added a commit to netresearch/go-cron that referenced this pull request Nov 28, 2025
Create docs/MIGRATION.md with detailed migration documentation:

- Quick start section with import path and go.mod changes
- Go version requirements comparison
- Behavioral differences with before/after examples:
  - TZ= parsing panic fixes (robfig#554, robfig#555)
  - Entry.Run() chain behavior fix (robfig#551)
  - DST spring-forward handling (robfig#541)
  - Step range validation (robfig#543)
  - Input length limits
- Type changes (EntryID: int -> uint64)
- New features overview (FakeClock, StopAndWait, Timeout, heap scheduling)
- Migration checklist
- Testing recommendations with code examples
- Troubleshooting section

Also update README.md to link to the comprehensive migration guide.

Closes #73
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant