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

The script will never generate a response: worker-build should emit all code inside a closure in a fetch function #255

Open
1 task done
samdenty opened this issue Dec 31, 2022 · 2 comments · May be fixed by #256
Open
1 task done

Comments

@samdenty
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

What version of workers-rs are you using?

0.0.0

Describe the bug

Currently, the emitted code for worker-build has everything defined on the top-level.

I'm not sure why, but for some reason variables defined in the top level are re-used across requests.

I'm using the cached crate in my project, and because the wasm memory is re-used across requests - it stops working and hangs with The script will never generate a response.

I'm not sure if this is the intended behaviour, re-using the wasm memory across requests - maybe it was done for perf reasons?

But anyways I've ran into this issue of randomly hanging workers loads of times, and it's really annoying. I think the default should be not to re-use memory across requests

Steps To Reproduce

No response

@samdenty samdenty changed the title worker-build should emit all code inside a closure of the fetch function worker-build should emit all code inside a closure in a fetch function Dec 31, 2022
@samdenty samdenty changed the title worker-build should emit all code inside a closure in a fetch function The script will never generate a response: worker-build should emit all code inside a closure in a fetch function Dec 31, 2022
@zebp
Copy link
Collaborator

zebp commented Jan 7, 2023

I'm not sure if this is the intended behaviour, re-using the wasm memory across requests

This is intentional but I'm not too sure on why this would cause the cached to crash, can you make a small reproducible example?

@samdenty
Copy link
Author

samdenty commented Jan 7, 2023

This only fixes the script will never generate response error for some cases, but I'm now running into cloudflare/rustwasm-worker-template#22 which I think may? be the root cause

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants