Skip to content

Always use ErrorKind::NotFound for Poller::delete of unknown source#260

Merged
notgull merged 1 commit intosmol-rs:masterfrom
apparentlymart:consistent-delete-err
Feb 5, 2026
Merged

Always use ErrorKind::NotFound for Poller::delete of unknown source#260
notgull merged 1 commit intosmol-rs:masterfrom
apparentlymart:consistent-delete-err

Conversation

@apparentlymart
Copy link
Contributor

@apparentlymart apparentlymart commented Feb 2, 2026

The IOCP and Event Port implementations were previously inconsistent with the others in how their delete implementations reacted to being asked to delete a source that wasn't previously registered with add: they would return Ok(()) without making any changes in that case, whereas the other implementations all return an ErrorKind::NotFound error.

Just to improve the consistency of behavior between the implementations, those two backends will now also return ErrorKind::NotFound errors. This should not change the behavior of any correct program, but might make it easier to catch incorrect usage when testing on a system that uses one of these two backends.

This closes #259. While writing this I realized I had incorrectly diagnosed the problem I was having as being caused by this inconsistency, but nonetheless it was still inconsistent.

@apparentlymart
Copy link
Contributor Author

apparentlymart commented Feb 2, 2026

Where I'm working today I don't have a Windows system or an Illumos/Solaris system to test this on.

I relied on the CI checks to run the test I added on Windows, where it seems to have passed. It doesn't seem like there are any CI checks for either platform that uses the "Event Port" implementation and so unfortunately I've not tested the change I made to that at all. Sorry about that. 😖

Some of the CI checks have failed but I don't think the failures were caused by what I changed here. Please let me know if I'm mistaken about that!

@apparentlymart apparentlymart force-pushed the consistent-delete-err branch 2 times, most recently from e6d8d9d to d9e5a1f Compare February 2, 2026 00:48
@apparentlymart apparentlymart marked this pull request as ready for review February 2, 2026 00:48
@notgull
Copy link
Member

notgull commented Feb 2, 2026

The cross failure is because the PS-Vita target is broken on rustix. I've filed an issue accordingly: bytecodealliance/rustix#1576

The FreeBSD failures are because Cirrus no longer ships the images of FreeBSD our current CI depends on. Let me update it.

@notgull
Copy link
Member

notgull commented Feb 5, 2026

@apparentlymart Please rebase on master in order to fix CI issues.

The IOCP and Event Port implementations were previously inconsistent with
the others in how their "delete" implementations reacted to being asked to
delete a source that wasn't previously registered with "add": they would
return `Ok(())` without making any changes in that case, whereas the other
implementations all return an `ErrorKind::NotFound` error.

Just to improve the consistency of behavior between the implementations,
those two backends will now also return ErrorKind::NotFound errors. This
should not change the behavior of any correct program, but might make it
easier to catch incorrect usage when testing on a system that uses one of
these two backends.
Copy link
Member

@notgull notgull left a comment

Choose a reason for hiding this comment

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

Thank you!

@apparentlymart
Copy link
Contributor Author

I've rebased it and indeed the checks all now seem to have passed. Thanks!

@notgull notgull merged commit b3ac6fe into smol-rs:master Feb 5, 2026
26 checks passed
@apparentlymart apparentlymart deleted the consistent-delete-err branch February 5, 2026 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent handling of Poller::delete of an event that already occurred

2 participants