Skip to content

Run test_requesting_large_resources_via_ssl separately #3181

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

Merged
merged 4 commits into from
Nov 15, 2023

Conversation

pquentin
Copy link
Member

@pquentin pquentin commented Nov 5, 2023

We have many timeouts on GitHub Actions due to those tests that can take minutes to run on overloaded CI runners. This is compounded by the fact they run six times (3 parametrizations * 2 SSL configuration - pyopenssl and standard library SSL). Running on multiple platforms isn't useful. We found a "Windows-specific" bug once but only because the Windows worker had less memory, and we have limit_memory tests now for the memory aspects.

@pquentin pquentin added Skip Changelog Pull requests that don't require a changelog entry and removed Skip Changelog Pull requests that don't require a changelog entry labels Nov 5, 2023
@pquentin pquentin force-pushed the separate-slow-ssl-test branch from b8177d9 to a6f2149 Compare November 5, 2023 18:17
sethmlarson
sethmlarson previously approved these changes Nov 6, 2023
Copy link
Member

@sethmlarson sethmlarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is excellent and I love the result for CI times! Now I'm inspired to look into the macOS times 🚀

@illia-v
Copy link
Member

illia-v commented Nov 6, 2023

Thanks @pquentin, this is a great idea!

Based on the following docstring, the library code relevant to the test may work differently in CPython 3.8, 3.9, and in any version with the pyOpenSSL injection.

The known cases:
* 3.8 <= CPython < 3.9.7 because of a bug
https://github.com/urllib3/urllib3/issues/2513#issuecomment-1152559900.
* urllib3 injected with pyOpenSSL-backed SSL-support.
* CPython < 3.10 only when `amt` does not fit 32-bit int.

What do you think about running the test in CPython 3.8, 3.9, and the latest one to make sure that no changes to _fp_read break the method for users of old CPython versions?

@pquentin
Copy link
Member Author

pquentin commented Nov 7, 2023

Excellent point, thank you. I'm wondering if I should not instead try to monkeypatch the calls that CPython is making to avoid decrypting multiple gigabytes of actual SSL data. If it proves difficult, then I'll run the integration tests on 3.8, 3.9 and latest. How does that sound?

@illia-v
Copy link
Member

illia-v commented Nov 7, 2023

@pquentin I'm curious to see what can be patched to avoid that.

IIRC there are three approaches CPython uses in different versions:

  • using SSL_read_ex call in a loop in CPython 3.10+
  • using SSL_read call in a loop with the python/cpython@153365d patch
  • using SSL_read call in a loop without the patch

They have different consequences for urllib3.

Also, when pyOpenSSL is used, the library is responsible for the decryption.

@sethmlarson
Copy link
Member

I'm liking the idea to run it on 3.8, 3.9, and latest if only to speed up every other PRs CI time for now? Quite the improvement, would like to take advantage 👀

@pquentin
Copy link
Member Author

I still think the mocking idea could work, but I'd prefer focusing my energy on more useful things! Added 3.8 and 3.9.

@pquentin pquentin requested a review from sethmlarson November 15, 2023 07:40
Copy link
Member

@illia-v illia-v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@illia-v illia-v merged commit 052617c into urllib3:main Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants