-
Notifications
You must be signed in to change notification settings - Fork 310
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
Fix SSL Error #4825
Fix SSL Error #4825
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,10 @@ | |
|
||
from warnings import warn | ||
|
||
import certifi | ||
from ssl import create_default_context | ||
from urllib.request import build_opener, HTTPSHandler, install_opener | ||
|
||
# optional dependencies | ||
try: | ||
import cupy as cp | ||
|
@@ -549,3 +553,13 @@ def create_directory_with_overwrite(directory): | |
if os.path.exists(directory): | ||
shutil.rmtree(directory) | ||
os.makedirs(directory) | ||
|
||
|
||
def install_ssl_cert(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Putting this here in
I'm really nervous about the idea of introducing a new runtime dependency this long after code freeze and this close to the release. And even just in general... does this really need to be in the Here in 24.12, to minimize risk, I think we should only run this at test time in CI here. That'd probably mean:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that it is not a good time to add an additional runtime dependency.. The codepaths in I don't think that the SSL issue would affect our users. I think this is just affecting CI because of how our images are setup. It would probably be fine to go with the solution you suggested and install it for our tests. I'll go ahead and add that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok got it, thanks for the explanation! Then yeah, I think doing this only as a testing dependency is a good solution. I tested whether this could just be run outside of of code I used to confirm that (click me)docker run \
--rm \
-it rapidsai/citestwheel:cuda11.8.0-rockylinux8-py3.10 \
bash
python -c 'import urllib.request; urllib.request.urlretrieve("https://data.rapids.ai/cugraph/results/resultsets.tar.gz", "foo.tar.gz")'
# urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED
cat > ./install-ca-certs.py <<EOF
import certifi
from ssl import create_default_context
from urllib.request import build_opener, HTTPSHandler, install_opener
ssl_context = create_default_context(cafile=certifi.where())
https_handler = HTTPSHandler(context=ssl_context)
install_opener(build_opener(https_handler))
EOF
python -m pip install certifi
python ./install-ca-certs.py
python -c 'import urllib.request; urllib.request.urlretrieve("https://data.rapids.ai/cugraph/results/resultsets.tar.gz", "foo.tar.gz")'
# urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED Given that, I think the way you've set this up as a testing-only dependency is a good solution. Thanks for working through it with me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for helping track this down and brainstorming a solution with me. |
||
""" | ||
Build and install an opener with the custom HTTPS handler. Use this when | ||
downloading datasets to have the proper SSL certificate. | ||
""" | ||
ssl_context = create_default_context(cafile=certifi.where()) | ||
https_handler = HTTPSHandler(context=ssl_context) | ||
install_opener(build_opener(https_handler)) |
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.
If you end up needing to push another change, I recommend reverting these import changes, which just look like stylistic changes to me (please correct me).
That'd make this whole file drop out of the diff, and make us even more confident that this is safe to merge this late in the release cycle.
But the changes look fine to me so don't push another commit and go through another round of CI just to revert this.
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.
Hmm, I don't believe I have any more changes to push as of now. The PR is just about to pass CI so let me know if you think it'll be better to still revert the changes to have as minimal of a diff has possible. Thanks!
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.
For those finding this from search... we talked offline and agreed that given the time-sensitivity of this, it wasn't worth another round of CI to revert this change.