-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Windows to Actions CI, Ruby 2.5, misc fixes #20
Conversation
Should this commit add it to .gitignore too? |
Good idea, probably the reason it was added... I'll fix EDIT: done |
56fb418
to
93944f5
Compare
CA_CERT = OpenSSL::X509::Certificate.new(read_fixture("cacert.pem")) | ||
SERVER_KEY = OpenSSL::PKey.read(read_fixture("server.key")) | ||
SERVER_CERT = OpenSSL::X509::Certificate.new(read_fixture("server.crt")) | ||
DHPARAMS = OpenSSL::PKey::DH.new(read_fixture("dhparams.pem")) | ||
TEST_STORE = OpenSSL::X509::Store.new.tap {|s| s.add_cert(CA_CERT) } | ||
|
||
CONFIG = { | ||
'host' => '127.0.0.1', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have the error output without this change?
I'm wondering if those rescue SystemCallError
lines scattered over the file are relevant to this. If this (bind to "localhost") works, can they be removed safely now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They may be. Current mingw jobs in ruby/ruby are failing because of this (see https://github.com/ruby/ruby/actions). I don't have any CI logs in my fork. I fixed locally, then pushed...
I didn't look at any blame/history, but if it's never been tested on Windows...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From https://github.com/ruby/ruby/runs/2456377434?check_suite_focus=true:
1) Failure:
TestNetHTTPS#test_session_reuse [D:/a/ruby/ruby/src/test/net/http/utils.rb:48]:
<[]> expected but was
<["[2021-04-28 10:35:33] ERROR Errno::ECONNABORTED: An established connection was aborted by the software in your host machine.\n" +
"\tD:/a/ruby/ruby/build/.ext/common/openssl/buffering.rb:80:in `sysread'\n" +
"\tD:/a/ruby/ruby/build/.ext/common/openssl/buffering.rb:80:in `fill_rbuff'\n" +
"\tD:/a/ruby/ruby/build/.ext/common/openssl/buffering.rb:323:in `eof?'\n" +
"\tD:/a/ruby/ruby/src/tool/lib/webrick/httpserver.rb:82:in `run'\n" +
"\tD:/a/ruby/ruby/src/tool/lib/webrick/server.rb:310:in `block in start_thread'\n"]>.
2) Failure:
TestNetHTTPS#test_session_reuse [D:/a/ruby/ruby/src/test/net/http/test_https.rb:166]:
<true> expected but was
<false>.
Thanks for the pointer, but this puzzles me... I was expecting the failing test cases to be test_get_SNI
and alike, which were only recently added and didn't have rescue SystemCallError
yet. (FWIW, the explanation for rescue
is in 2504847.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate this. I pushed the test file change to ruby-loco and my ruby/ruby fork. test-all passed everywhere.
But, in test-spec, it's timing out in ruby-loco, and there are errors in:
spec/ruby/library/net/http/http/active_spec.rb
spec/ruby/library/net/http/http/get2_spec.rb
Maybe more...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re the failures, thanks for looking further. I can revert that commit and the other rescue SystemCallError
code?
I'm looking at the spec failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding localhost vs 127.0.0.1 and rescue, I /think/ the changes in this Pull Request are correct, but I can't confirm - I don't know in which environment it is actually needed. Without the changes, TestNetHTTPS#test_min_version
must fail in such setup, but we have no such a setup in our CI (rubyci.org / GitHub Actions).
ruby/ruby's Github Actions failure on mingw (TestNetHTTPS#test_session_reuse
) looks like a separate issue (as I wrote in my last comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your additional investigation. I saw ruby-loco failed, then went to ruby/ruby, and saw Ubuntu & macOS passing (along with CI here), but failing mingw, I assumed it was probably a test issue. Didn't even look at lib code here. I did review the code in ruby/openssl test_ssl_session.rb.
Anyway, re the sleep 2.5
addition, I think http.finish
is closing the socket, and the handshake occurs when http.start
is called (it calls connect_nonblock
)? So I'm not sure what the sleep is affecting, as I would think keep_alive_timeout
would be different than a 'data' timeout, but I haven't looked...
Also, wondering whether to define HOST_IP = '127.0.0.1'
and use it for all refs in the test?
EDIT:
Re test_session_reuse
, the following works:
http.start
http.get("/")
http.finish
http.start
assert_equal true, http.instance_variable_get(:@socket).io.session_reused?
assert_equal $test_net_http_data, http.get("/").body
http.finish
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#21 should fix TestNetHTTPS#test_session_reuse
, though running the test suite takes 10 minutes on Windows. This is due to the slow fallback from IPv6 (localhost) to IPv4 (127.0.0.1) and this (your) Pull Request should resolve it.
Session resumption was not done correctly because the test case was establishing 3 TLS connections in total instead of the intended 2 due to the bug & a change in OpenSSL 1.1.1 which prohibited using a session ticket more than once in TLS 1.3 clients (openssl/openssl#6601).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change in OpenSSL 1.1.1
Thanks. I vaguely recalled something about that, but my finding it might have taken a while...
Should I change test_session_reuse
as above? session_reused?
is important, but the real test is can the socket be used, and hence, the body assert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed a Rakefile change that wasn't needed. I revised the test as above, and also added the constant. Changed it to an IPv6 address locally, and all passed.
And, since I haven't contributed here previously, it needs approval for CI. Passed in my fork. Thanks.
93944f5
to
f6ae5f4
Compare
f6ae5f4
to
d1b02d3
Compare
Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
d1b02d3
to
4fbd463
Compare
Since this changes a few files that are also changed in #19, I added Ruby 2.5 to Actions, and listed @deivid-rodriguez as a co-author. Testing was being run with |
I'm still in favour of releasing a gemified version of net-http still supporting ruby 2.5, and then dropping support, but it sounds unrelated to this PR. |
This PR does not change any 'lib' files, only files related to testing and building. Using Ruby 2.5 is part of that. I'll be happy to revert those changes. This PR fixes an issue that has happened before, and that is a ruby repo (std-lib, default or bundled gem) breaking CI in ruby/ruby, which has been failing since 27-Apr... |
Restoring support for ruby 2.5 seems unrelated to getting the CI back to green. The fact that two separate PRs change the same part of a repository doesn't mean they are related or should be introduced together. That said, I don't make any decisions here, but again, I'd be very happy if ruby 2.5 support is restored. I just feel it unnecessarily makes this PR more controversial 🤷♂️. We'll see what maintainers say. |
Fixed at #181 Replacing |
No description provided.