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

BREAKING(ext/net): improved error code accuracy #25383

Merged
merged 3 commits into from
Sep 27, 2024

Conversation

lucacasonato
Copy link
Member

Fixes #13086

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM!

.map_err(|_| bad_resource("Listener has been closed"))?;
.map_err(|_| {
std::io::Error::new(
std::io::ErrorKind::Interrupted,
Copy link
Member

@piscisaureus piscisaureus Sep 12, 2024

Choose a reason for hiding this comment

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

Interrupted is not really an appropriate error code in this case. Do you have something like Aborted ?

The reason is that EINTR is used very specifically for cases where a syscall is interrupted by a signal and should be retried. That semantic spills over into rust, as per the docs:

This operation was interrupted.
Interrupted operations can typically be retried.

Copy link
Member Author

Choose a reason for hiding this comment

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

You suggested to use Interrupted here: #13075 (comment). We do not have an Aborted error.

I can introduce a new Closed error, and use that everywhere we throw a BadResource error - BadResource is not descriptive anyway.

Copy link
Member

Choose a reason for hiding this comment

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

Closed seems reasonable - BadResource is a catch-all that is completely non-descriptive to users. Maybe we could make Closed extends BadResource to limit the impact as there are a lot of checks for Deno.errors.BadResource.

Copy link
Member Author

Choose a reason for hiding this comment

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

We discussed this offline: we're reverting back to BadResource to behave like the EBADF that libuv returns in this case. We are keeping the Busy changes though.

@lucacasonato lucacasonato enabled auto-merge (squash) September 27, 2024 13:38
@lucacasonato lucacasonato merged commit 3134abe into denoland:main Sep 27, 2024
17 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.

v2: change tcp/unix listener error types
3 participants