-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
linkcheck tests: test webservers: enable HTTP/1.1 protocol #11392
linkcheck tests: test webservers: enable HTTP/1.1 protocol #11392
Conversation
dfca731
to
a4667b5
Compare
I'm having difficulty replicating the unit test failures here (mostly timeouts) on Python 3.11.2. To try to reduce the differences between my local env and the GitHub workflow, I've used |
…0 protocol (default) to HTTP/1.1
…ting the 'close_connection' handler attribute instead of calling connection.close Ref: https://docs.python.org/3/library/http.server.html#http.server.BaseHTTPRequestHandler.close_connection
…er capture to before any server-side communication has been initiated by the handler (cherry picked from commit 4d485ae)
…nnection after response body is written, since we do not anticipate the client will read it Ref: sphinx-doc#11340 (comment)
a4667b5
to
824202e
Compare
After installing a 2.x version of Given the unsupported-mix between |
This comment was marked as outdated.
This comment was marked as outdated.
…n 'requests'" This reverts commit b89450c.
@@ -19,7 +19,7 @@ | |||
class HttpServerThread(threading.Thread): | |||
def __init__(self, handler, *args, **kwargs): | |||
super().__init__(*args, **kwargs) | |||
self.server = http.server.HTTPServer(("localhost", 7777), handler) | |||
self.server = http.server.ThreadingHTTPServer(("localhost", 7777), 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.
Note for reviewers: without threaded webservers, HTTP1.1's ability to leave connections open causes difficulty for the Sphinx unit tests in combination with urllib3
commit urllib3/urllib3@a80c248 - a connection-pool thread safety fix, included from v2.0.0 of that library onwards.
Looks like timeout errors on CI:
|
Can you link to an example build log? That test is definitely troublesome, I'm not certain I've figured out exactly why it fails though (so any more context could be useful). |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
After thinking about the previous few comments (one, two, three) (apologies for the stream-of-consciousness) related to The test failure in Increasing the timeouts again (as in d8f15c7) could work around it short-term - but if possible I'd like to spend time figuring out whether there's a deeper problem and solution, because if there is, then I think the time spent investigating should be recovered during the application's usage on aggregate. |
This comment was marked as outdated.
This comment was marked as outdated.
Nope, I'm stuck re: I'm going to remove the |
0817ade
to
94644fd
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Taking a break from this until next week. So far from jayaddison#3 I'm hopeful that #11426 resolves the test flakiness observed here, but also note that there was at least one unrelated timeout that occurred. |
An update: I do think that the refactor from #11426 eliminates the |
@AA-Turner @francoisfreitag I'd like to apologise for my extremely verbose communication while developing a bunch of the changes offered for Sphinx. I think that was quite verbose and distracting. When you have time, could you let me know whether the pull requests I currently have open are worth progressing, and whether further changes by me would be considered? If not, that's OK - I'd prefer not to consume your and my own time if further changes from me are unlikely to be accepted. Thanks you in advance - and I'll try to improve my communication style and approach; I'd be glad for any feedback. You've both been supportive collaboratively and helpful technically in terms of finding problems in the pull requests so far. |
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.
HTTP/1.1 is probably used more often than 1.0, so might as well use that in tests. 👍
Thanks again @francoisfreitag 👍 My perspective is that HTTP 1.1 is a more widely-used protocol than HTTP 1.0 nowadays, although I fully admit that that could be biased - and I didn't find statistics comparing those two protocol versions on the HTTP Archive website when I looked a few moments ago. In some ways HTTP 1.0 seems to me to be more robust against unusual failure modes than HTTP 1.1 -- but I think that the motivating factors for it - namely more efficient use of network resources, particlarly for websites that receive high volumes of traffic - were reasonable. |
@jayaddison please could you resolve conflicts from #11426? A |
Done; it looks like there may be one or two more |
Ok, the missed content-length header has also been resolved. There was only one codesite that required updating. The other that I had been considering was this |
Thanks @jayaddison! A |
Thank you! |
Feature or Bugfix
Purpose
linkcheck
builder), this change upgrades the communication protocol of the test webservers, allowing multiple requests to occur within a single HTTP connection.Detail
single-threadedtest webserver does not become blocked by thelinkcheck
client, this change includes the resource-cleanup (connection close) behaviour from linkcheck builder: close streamed HTTP response objects when no content reads are required #11318.Relates