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

fix(serverless): functions timeout #276

Merged
merged 1 commit into from
Nov 24, 2022
Merged

fix(serverless): functions timeout #276

merged 1 commit into from
Nov 24, 2022

Conversation

QuiiBz
Copy link
Member

@QuiiBz QuiiBz commented Nov 24, 2022

About

Fix functions timeout not working properly in serverless (but working fine in runtime).

This is because serverless uses a LocalPoolHandle to always execute an isolate on the same thread while allowing to have multiple threads to run a pool of isolate. Using tokio::task::spawn, the timeout future is spawned on the same thread as the isolate, and will be blocked when the isolate blocks (e.g long script parsing, infinite loops...).

The solution is to use a tokio::task::spawn_blocking to spawn the timeout future on another thread where we can block.

@QuiiBz QuiiBz enabled auto-merge (squash) November 24, 2022 07:24
@QuiiBz QuiiBz merged commit 6dca4fd into main Nov 24, 2022
@QuiiBz QuiiBz deleted the fix/serverless-timeouts branch November 24, 2022 07:27
@QuiiBz QuiiBz mentioned this pull request Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant