-
Notifications
You must be signed in to change notification settings - Fork 196
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
cloud.Function timeout not working in simulator - vm.runInContext doesn't seem to kill the function #1980
Comments
Hi, This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. |
Hi, This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. |
Based on this issue nodejs/node#3020 it seems like the behavior we're seeing is unavoidable as long as we're using Node's Possible solution: #4725 |
This pull request fixes a range of funky JavaScript issues we've had running inflight code in the Wing simulator by switching internally from running JS code in a `vm` to running JS code using Node.js child processes. The main issues with `vm` are: - several third-party JavaScript dependencies behave differently when executed inside a `vm` and outside. This may be related to differences in vm behavior as described in nodejs/node#28823 - we cannot easily stop/kill code executing in a `vm` process, making it impossible to simulate cloud.Function timeouts Fixes #1980 Fixes #4131 Fixes #4118 Fixes #4792 Closes #4725 ## Checklist - [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted) - [x] Description explains motivation and solution - [x] Tests added (always) - [ ] Docs updated (only required for features) - [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
Congrats! 🚀 This was released in Wing 0.59.43. |
Community Note
I tried this:
run a cloud function with a timeout set to 1s, that is calling a timeout of 1.5s.
I expected this:
The process that the function is running on stops, and an error is thrown.
Instead, this happened:
The function exceeded the timeout. No error was thrown.
it happened because of vm.runInContext doesn't "wait" for the inflight code to run, but executes it synchronically (without "await"). We suspect it runs on a different process and is not interrupted by the timeout completion.
Is there a workaround?
No response
Component:
SDK
Wing Version:
No response
Node.js Version:
No response
Platform(s):
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: