Skip to content

Fix handling of closed IO objects in IO::Event::Selector::Select.#165

Merged
ioquatix merged 5 commits intomainfrom
io-event-select-closed
Apr 5, 2026
Merged

Fix handling of closed IO objects in IO::Event::Selector::Select.#165
ioquatix merged 5 commits intomainfrom
io-event-select-closed

Conversation

@ioquatix
Copy link
Copy Markdown
Member

@ioquatix ioquatix commented Apr 5, 2026

IO.pipe do |input, output|
	Thread.new do
		sleep(0.1)
		input.close
	end

	pp IO.select([input], [], [], 1.0)
end

This program can raise both IOError or Errno::EBADF depending on the system. We need to handle that on Ruby 4+ which has better support for IO#close w.r.t. the fiber scheduler.

Types of Changes

  • Bug fix.

Contribution

@ioquatix ioquatix force-pushed the io-event-select-closed branch from dbac7dc to 5446f3d Compare April 5, 2026 03:21
@ioquatix ioquatix force-pushed the io-event-select-closed branch from 5446f3d to e075233 Compare April 5, 2026 03:51
@ioquatix ioquatix merged commit 7313f0a into main Apr 5, 2026
52 of 58 checks passed
@ioquatix ioquatix deleted the io-event-select-closed branch April 5, 2026 04:53
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.

1 participant