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

perf(ext/ffi): switch from middleware to tasks #21239

Merged
merged 12 commits into from
Dec 12, 2023

Conversation

mmastrac
Copy link
Contributor

@mmastrac mmastrac commented Nov 17, 2023

Deno-side changes for denoland/deno_core#350

@mmastrac mmastrac changed the title chore: update deno_core with reentrant op flags [WIP] chore: update deno_core with less realms [WIP] Nov 22, 2023
@mmastrac mmastrac force-pushed the promise_test branch 2 times, most recently from 2d0c89e to a47ce60 Compare November 26, 2023 16:21
@mmastrac mmastrac changed the title chore: update deno_core with less realms [WIP] chore: update deno_core with task experiment [WIP] Nov 26, 2023
@denoland denoland deleted a comment from denobot Nov 26, 2023
@mmastrac mmastrac changed the title chore: update deno_core with task experiment [WIP] perf(ext/ffi): switch from middleware to tasks Nov 30, 2023
Copy link
Collaborator

@aapoalas aapoalas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just curious about how you did error handling.

};

async_work_sender.spawn_blocking(move |scope| {
args.run(scope);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: What happens with errors thrown from here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because these are tasks and we're technically violating the contract by allowing them to bubble into the scope, they end up as "uncaught errors". It doesn't kill the runtime but it isn't a great situation.

It should not be the same as our current state of affairs, however, but I suppose we could add a tc_scope here and print a last-ditch message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that we will need to figure out what to do with this test as it's failing right now -- either we could punt with a TODO for later, or try to add the last-ditch handler.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. I did add the error and unhandled rejection listeners in the test but they were not getting fired. Are you sure the errors end up as properly handled uncaught errors/rejections?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me dig into this a bit and see what is going on before we land it...

);

globalThis.addEventListener("error", (data) => {
console.log("Unhandled error");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This never gets logged

console.log("Unhandled error");
data.preventDefault();
});
globalThis.onerror = (data) => {
Copy link
Collaborator

@aapoalas aapoalas Nov 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nor does this get called; this also should be redundant with the one above.

test_ffi/tests/ffi_callback_errors.ts Outdated Show resolved Hide resolved
@mmastrac mmastrac merged commit a4f45f7 into denoland:main Dec 12, 2023
14 checks passed
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 this pull request may close these issues.

None yet

2 participants