-
-
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
Refactor: linkcheck builder: reduce the lifetime of the 'response' variable #11432
Refactor: linkcheck builder: reduce the lifetime of the 'response' variable #11432
Conversation
Thanks @jayaddison! A |
https://github.com/sphinx-doc/sphinx/actions/runs/5615478788/job/15215837543 -- LaTeX timed out
|
See also a similar test failure at: https://github.com/sphinx-doc/sphinx/actions/runs/5615865316/job/15217324918 |
with retrieval_method(url=req_url, auth=auth_info, config=self.config, | ||
**retrieval_kwargs, **kwargs) as response: | ||
if response.ok and anchor and not contains_anchor(response, anchor): | ||
raise Exception(__(f'Anchor {anchor!r} not found')) |
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.
It looks like I introduced a regression with the rewrite of these lines - and the regression is reported here: #11532 (comment)
Basically: when anchor checking is not enabled -- that is, self.linkcheck_anchors
is False
-- the first retrieval method returned is an HTTP HEAD request. It can have response.ok
, and the anchor
value may be non-empty -- because we continue to extract (partition) the anchor from the uri
regardless of whether anchor linkchecking will be performed. The HTTP HEAD response doesn't contain a content body, so contains_anchor
will return false, and the exception is raised.
I'll prepare a fixup/patch for this and some test coverage to cover this situation within the next few days.
Feature or Bugfix
Purpose
response
variable that holds the results of HTTP request results should be considered live and is non-garbage-collectable.Detail
response
variable may be a contributing factor to timeouts that occur during our unit tests.Relates