Skip to content

IO.select does not report TCP out-of-band data as priority readiness #9506

Description

Environment

jruby 10.1.0.0 (4.0.0) 2026-04-20 32f988b78c OpenJDK 64-Bit Server VM 21.0.11 on 21.0.11 +indy +jit [arm64-darwin]

Compared with:

ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +PRISM [arm64-darwin24]

Reproduction

# frozen_string_literal: true

require "socket"

server = TCPServer.new("127.0.0.1", 0)
client = TCPSocket.new("127.0.0.1", server.addr[1])
socket = server.accept

begin
  client.send("!", Socket::MSG_OOB)

  readable, writable, priority = IO.select(nil, nil, [socket], 1)

  puts RUBY_DESCRIPTION
  puts "priority: #{priority&.include?(socket).inspect}"

  unless priority&.include?(socket)
    warn "Expected socket to be reported as priority-ready."
    exit 1
  end
ensure
  socket&.close
  client&.close
  server&.close
end

Expected behavior

After sending TCP out-of-band data with Socket::MSG_OOB, IO.select(nil, nil, [socket], timeout) should report the socket in the priority result array.

CRuby reports:

ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +PRISM [arm64-darwin24]
priority: true

Actual behavior

JRuby times out without reporting priority readiness:

jruby 10.1.0.0 (4.0.0) 2026-04-20 32f988b78c OpenJDK 64-Bit Server VM 21.0.11 on 21.0.11 +indy +jit [arm64-darwin]
priority: nil
Expected socket to be reported as priority-ready.

Context

This came up while enabling JRuby support in io-event. IO::Event::Selector::Select supports IO::PRIORITY using Ruby's IO.select priority array. The corresponding test passes on CRuby but has to be skipped on JRuby because the priority event is not reported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions