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
Lazily load openssl
#3850
Merged
Merged
Lazily load openssl
#3850
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deivid-rodriguez
force-pushed
the
openssl_one_more
branch
2 times, most recently
from
July 24, 2020 10:01
2e1f8e3
to
a042402
Compare
deivid-rodriguez
force-pushed
the
openssl_one_more
branch
from
September 2, 2020 11:04
a042402
to
85df12d
Compare
I filled the description of this PR and marked it as ready! |
This reverts commit e0cbc9c.
I believe the intention here is that the `OpenSSL` constant is autoloaded if not yet required. Just checking `defined?` on it won't do this.
We're still running into the `jruby` bug where the `OpenSSL` constant can't be found even if it should be there. My hypotheses is that this is happening because `net/http` still sets up an `autoload` for it. Since we don't control that code, we can't really remove that `autoload`, so I'm guessing doing the reserve (only `autoload` it and never explicitly require it) should do the trick as well?
I found this file, which was used in the past to simulate openssl not being available. It seems better than the current hack because it doesn't require renaming system files which is quite invasive.
deivid-rodriguez
force-pushed
the
openssl_one_more
branch
from
September 16, 2020 17:47
85df12d
to
3cfed75
Compare
I didn't see the jruby crashes again since the last time, but since this has other benefits I decided to go ahead with this. If it causes any issues, I'll revert it. |
deivid-rodriguez
changed the title
Try to fix openssl availability issues on jruby
Lazily load Dec 7, 2020
openssl
deivid-rodriguez
added a commit
that referenced
this pull request
Dec 7, 2020
Try to fix openssl availability issues on jruby (cherry picked from commit 8fd5dee)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This is a followup to #3809, and all the other PRs linked to that trying to deal with jruby load service issues.
To recap the issue, as first mentioned here, apparently on jruby sometimes autoloading a constant and making it available through
require
can lead to weird concurrency issues that result in the constant not being available in the end.So the solution we've been proposing for these issue is to not do that, and either require or
autoload
, but not both.Everything seems good now, except for
OpenSSL
constants, where we sometimes still get errors. In #3809 I unified our code to always require instead of autoloadingopenssl
. However, the problem still reproduces on our latest code. See https://github.com/rubygems/rubygems/pull/3867/checks?check_run_id=1059447242, for example:After closer inspection, I noticed that the constant was still getting autoloaded
here
: https://github.com/ruby/ruby/blob/93b78abd774109d1333d59eaf439b2e69ed0fe00/lib/net/http.rb#L25. And we can't really avoid that unless we stop requiringnet/http
and vendor it instead.So my approach was to instead of requiring
openssl
always, autoload it always. Other than potentially fixing the bug, this has two extra benefits:net-http-persistent
gem.So I'd like to try this approach.
Tasks:
I will abide by the code of conduct.