Skip to content

Add the #io_close scheduler hook - #483

Open
tavianator wants to merge 1 commit into
mainfrom
scheduler-io-close
Open

tavianator wants to merge 1 commit into
mainfrom
scheduler-io-close

Conversation

@tavianator

Copy link
Copy Markdown
Contributor

Add support for asynchronous close operations.

Link: #436

Types of Changes

  • New feature.

Contribution

Comment thread lib/async/scheduler.rb
# @parameter descriptor [Integer] The fd to close.
# @returns [Boolean] Whether the selector closed the descriptor.
def io_close(descriptor)
!!@selector&.io_close(descriptor)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P2] Preserve descriptor ownership if close is interrupted

URing's io_close can yield while draining a full submission queue, before it has queued this descriptor's close. If the task is cancelled there, Ruby has already marked the IO closed, and the exception skips its fallback close, leaking the OS descriptor. A selector shim reproduces the ownership loss: closed? is true while the fd remains open. Can we ensure the close is accepted before cancellation can unwind this hook, and add a regression test for that interruption?

This branch has not been deployed

No deployments
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.

2 participants