You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Concurrent cron Add calls can allocate the same job ID #678
Cron job creation allocates an ID with a check-then-create sequence. Two processes adding jobs in the same second can both observe the same directory as absent, select the same ID, and write into the same job directory.
Relevant code
internal/cron/store.go: Add calls allocID and later writeJob.
allocID uses os.Stat to find an available timestamp ID.
writeJob uses os.MkdirAll, which does not reserve the ID exclusively.
Both writers use metadata.json.tmp.
Observed at commit 6fc1220.
Failure modes
One job can replace another, writers can interfere through the shared temp name, or both callers can receive the same ID.
Suggested fix
Reserve candidates atomically with os.Mkdir(dir, 0700), retry only on os.ErrExist, and remove the reserved directory if initial metadata creation fails. Add a concurrent cross-store test with a frozen clock.
Activity