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

FFI: Errors cannot be thrown after a nonblocking function call #18131

Open
rojvv opened this issue Mar 11, 2023 · 2 comments · May be fixed by #18436
Open

FFI: Errors cannot be thrown after a nonblocking function call #18131

rojvv opened this issue Mar 11, 2023 · 2 comments · May be fixed by #18436
Labels
bug Something isn't working correctly FFI Related to Foreign Function Interface APIs needs investigation requires further investigation before determining if it is an issue or not

Comments

@rojvv
Copy link
Contributor

rojvv commented Mar 11, 2023

call_some_nonblocking_function();
console.debug("Reaches here.");
throw new Error(); // not thrown
@littledivy littledivy added bug Something isn't working correctly needs investigation requires further investigation before determining if it is an issue or not FFI Related to Foreign Function Interface APIs labels Mar 22, 2023
@rojvv
Copy link
Contributor Author

rojvv commented Mar 25, 2023

Full reproduction example: https://github.com/roj1512/deno-18131-reproduction

andreubotella added a commit to andreubotella/deno that referenced this issue Mar 25, 2023
Tokio's `spawn_blocking` allows running blocking operations, which in
Deno include file I/O and "non-blocking" FFI, in a thread pool
separate from the thread running the JS event loop. However, by
default, when the tokio runtime is dropped, it will block on the main
thread until all such blocking operations have completed.

This is a problem, since a non-blocking FFI call might never actually
finish, which would keep the Deno process running forever, even if it
would otherwise have finished earlier because of an uncaught
exception. This change, therefore, sets a time limit of 0.5 seconds to
wait for those blocking tasks to finish.

Closes denoland#18131.
@aapoalas
Copy link
Collaborator

This seems to be essentially the same issue as #14333 just with different API triggering the behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly FFI Related to Foreign Function Interface APIs needs investigation requires further investigation before determining if it is an issue or not
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants