Open gianzellweger opened 8 months ago
Update: Since updating to wrangler 3.36.0, there is now an error on the page, linking to this file and location:
/usr/local/lib/node_modules/wrangler/node_modules/miniflare/dist/src/workers/core/entry.worker.js:895:22
I believe this is the file on GitHub. https://github.com/cloudflare/workers-sdk/blob/c5135224f5e58391a26befbee3f389d69f50a71b/packages/miniflare/src/workers/core/entry.worker.ts#L272
The problem hasn't resolved yet.
I'm going to transfer this to the workers-rs
repo, as it looks like this is a bug specific to delays in Rust code compiled to WASM.
I'm not sure exactly how the runtime detects that futures arent making progress, but I suspect the blocking sleep here is the issue. Can you use an async sleep such as tokio::time::sleep
?
Which Cloudflare product(s) does this pertain to?
Workers Runtime, Wrangler core
What version(s) of the tool(s) are you using?
3.34.2 [Wrangler], 0.0.21 [workers-rs], 1.78.0-nightly [Rust]
What version of Node are you using?
21.7.1
What operating system and version are you using?
Linux (Fedora) (arm64)
Describe the Bug
Observed behavior
If a minimal delay (or some work) is introduced, the server throws an error. The log is the following:
Expected behavior
I would expect the work to finish and to respond to the request.
Steps to reproduce
[event(fetch)]
pub async fn main(_req: Request, _env: Env, _ctx: worker::Context) -> Result {
std::thread::sleep(Duration::from_micros(200)); // Shorter delays/actual work also triggers this behavior
return Response::from_html("");
}
I also tried using wrangler beta, but to avail.
Please provide a link to a minimal reproduction
No response
Please provide any relevant error logs
This is a log of starting the local server, opening the page, and then closing the server: