Skip to content

OpenURI tests' with_http fails due to dead thread #9276

@headius

Description

@headius

There's some issue with the with_http method used by the Ruby 4.0 OpenURI tests resulting in a number of failures in test:mri:stdlib that all look the same. It's unclear if this is a problem with this test code or something broken in OpenURI itself.

The code:

def with_http(log_tester=lambda {|log| assert_equal([], log) })
log = []
host = "127.0.0.1"
srv = SimpleHTTPServer.new(host, 0, log)
server_thread = srv.start
server_thread2 = Thread.new {
server_thread.join
if log_tester
log_tester.call(log)
end
}
port = srv.instance_variable_get(:@server).addr[1]
client_thread = Thread.new {
begin
yield srv, "http://#{host}:#{port}", server_thread, log
ensure
srv.shutdown
end
}
assert_join_threads([client_thread, server_thread2])
end

Example error:

TestOpenURI#test_redirect_auth_success [/home/runner/work/jruby/jruby/test/mri/open-uri/utils.rb:340]:
exceptions on 1 threads:
#<Thread:0x534df4b /home/runner/work/jruby/jruby/test/mri/open-uri/utils.rb:324 dead>:
org/jruby/ext/socket/RubyTCPServer.java:143:in 'accept': stream closed in another thread (IOError)
	from /home/runner/work/jruby/jruby/test/mri/open-uri/utils.rb:22:in 'block in start'
	from org/jruby/RubyKernel.java:1687:in 'loop'
	from /home/runner/work/jruby/jruby/test/mri/open-uri/utils.rb:21:in 'block in start'

The tests will be excluded for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions