cloudflare / workers-sdk

โ›…๏ธ Home to Wrangler, the CLI for Cloudflare Workersยฎ
https://developers.cloudflare.com/workers/
Apache License 2.0
2.41k stars 592 forks source link

๐Ÿ› BUG: Durable Object Alarms not triggering after a code reload #5948

Open lambrospetrou opened 1 month ago

lambrospetrou commented 1 month ago

Which Cloudflare product(s) does this pertain to?

Workers Runtime

What version(s) of the tool(s) are you using?

wrangler 3.57.1

What version of Node are you using?

v20.10.0

What operating system and version are you using?

Windows 10 - WSL2 - Ubuntu 22.04.3 LTS

Describe the Bug

Observed behavior

Scenario:

The alarm triggers as expected, but as soon as the code has changes and the worker reloads, then the alarm stops triggerring. Even though the storage of the DO, and the alarm itself (through ctx.storage.getAlarm()), still exist just fine.

Check the logs below where they show the alarm triggering every 5-seconds, and then they stop after the reload:

triggers.cron alarm at 1717140295004 ::nextAlarmExecutionMs: 1717140300000 ::triggerDetails: {"scriptId":"s_nlP0bNFp6PK29WRwG2CDDzG","triggerId":"strig_cron_sG9btQVqCJQ1P","cronExpression":"*/5 * * * * *","targetUrl":"http://skybear.test:8080/-_-/v1/scripts.triggers.cron.Run?scriptId=s_nlP0bNFp6PK29WRwG2CDDzG&triggerId=strig_cron_sG9btQVqCJQ1P"}

triggers.cron alarm at 1717140300004 ::nextAlarmExecutionMs: 1717140305000 ::triggerDetails: {"scriptId":"s_nlP0bNFp6PK29WRwG2CDDzG","triggerId":"strig_cron_sG9btQVqCJQ1P","cronExpression":"*/5 * * * * *","targetUrl":"http://skybear.test:8080/-_-/v1/scripts.triggers.cron.Run?scriptId=s_nlP0bNFp6PK29WRwG2CDDzG&triggerId=strig_cron_sG9btQVqCJQ1P"}

triggers.cron alarm at 1717140305003 ::nextAlarmExecutionMs: 1717140310000 ::triggerDetails: {"scriptId":"s_nlP0bNFp6PK29WRwG2CDDzG","triggerId":"strig_cron_sG9btQVqCJQ1P","cronExpression":"*/5 * * * * *","targetUrl":"http://skybear.test:8080/-_-/v1/scripts.triggers.cron.Run?scriptId=s_nlP0bNFp6PK29WRwG2CDDzG&triggerId=strig_cron_sG9btQVqCJQ1P"}
โŽ” Reloading local server...
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ [b] open a browser, [d] open Devtools, [l] turn off local mode, [c] clear console, [x] to exit                                                           โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

# I KILLED THE wrangler server here after 1 minute.
โŽ” Shutting down local server...

Expected behavior

I expected the alarm to continue triggering as usual since all the storage+alarm state is correct.

Steps to reproduce

I don't have a minimal reproduction at hand...need to clean up my project to get it.

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

lambrospetrou commented 1 month ago

@threepointone As discussed in https://twitter.com/threepointone/status/1796435924529905771