cloudflare / cloudflare/workerd

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

Open
#3,566 4 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
8.7k
Forks
739
Avg merge
2d 20h
Merged PRs (30d)
174

Description

### 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:
- I have a simple Durable Object with an Alarm setup to trigger every 5 seconds.
- I start `wrangler dev` to watch my source code files and reload the worker.

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_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.