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

Can a Durable Object have an alarm for a time in the past that will never fire? #18324

Open
johtso opened this issue Nov 21, 2024 · 1 comment
Assignees
Labels
content:edit Request for content edits documentation Documentation edits product:durable-objects Durable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/

Comments

@johtso
Copy link
Contributor

johtso commented Nov 21, 2024

Existing documentation URL(s)

https://developers.cloudflare.com/durable-objects/api/alarms/

What changes are you suggesting?

The documentation describes that there is guaranteed at-least-once execution of alarms.

I've experienced situations where getAlarm() returns a time in the past, but there are no unhandled errors to be seen and days have past.

I'm using a Durable Object as a pseudo long running process by triggering an alarm every 10 seconds. The previous version of my code had a CRON trigger every minute that would check if an alarm was set and if not, would schedule a new alarm (as there should always be an alarm).

That's how I noticed the issue, my DO had been doing nothing all weekend. getAlarm was returning a days old alarm time, but it wasn't being triggered.

I've now modified my code to also check if the current alarm is greater than a certain time in the past, and if so reset it.

If the system is designed in such a way that an old alarm time will never be triggered (regardless of how that situation arises), then that should be documented. Someone else mentioned they've been experiencing similar issues with alarms set only a short amount of time in the future (less than 10 seconds). Is there an undocumented limitation here?

Sorry if this is a bit of an odd mix of documentation request and bug report, but it feels like there is some undocumented behaviour here.

Additional information

No response

@johtso johtso added content:edit Request for content edits documentation Documentation edits labels Nov 21, 2024
@github-actions github-actions bot added the product:durable-objects Durable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/ label Nov 21, 2024
@johtso johtso changed the title Under what conditions can a Durable Object Alarm remain unfired? Can a Durable Object have an alarm for a time in the past that will never fire? Nov 21, 2024
@vy-ton
Copy link
Contributor

vy-ton commented Nov 21, 2024

@johtso This is more likely a bug. I'm not aware of an undocumented limit here.

Could you email [email protected] with your account id, DO namespace id, and object ids where you see this alarm behavior so our team can investigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content:edit Request for content edits documentation Documentation edits product:durable-objects Durable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/
Projects
None yet
Development

No branches or pull requests

5 participants