Skip to content
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

Linux documentation build memory hog #11116

Closed
marxin opened this issue Jan 9, 2023 · 6 comments
Closed

Linux documentation build memory hog #11116

marxin opened this issue Jan 9, 2023 · 6 comments
Milestone

Comments

@marxin
Copy link
Contributor

marxin commented Jan 9, 2023

Describe the bug

As mentioned here:
https://lore.kernel.org/all/cb916eae-fdf6-504f-8f38-7928e0fa8344@gmail.com/

the Linux kernel documentation builds https://docs.kernel.org/doc-guide/sphinx.html?highlight=sphinx#sphinx-build gets slower and consumer much more memory.

I bisected that to 080517c.
@AA-Turner: Can you please take a look?

How to Reproduce

Clone Linux repo and apply:
https://lore.kernel.org/all/87wn629ggg.fsf@meer.lwn.net/

make htmldocs

Environment Information

Aforementioned Sphinx version.

Sphinx extensions

No response

Additional context

No response

@AA-Turner
Copy link
Member

AA-Turner commented Jan 9, 2023

@AA-Turner: Can you please take a look?

I'm taking a break due to other work until Easter; apologies for this. I'd advise pinning to an earlier version if a root cause can't be found.

A

@marxin
Copy link
Contributor Author

marxin commented Jan 9, 2023

Do you think it would make sense to bisect docutils in order to find what caused that?

@marxin
Copy link
Contributor Author

marxin commented Jan 10, 2023

So the issue is caused by the following removed hunk:

sphinx/sphinx/util/nodes.py

Lines 630 to 643 in 4660b62

def _new_copy(self: Element) -> Element:
"""monkey-patch Element.copy to copy the rawsource and line
for docutils-0.16 or older versions.
refs: https://sourceforge.net/p/docutils/patches/165/
"""
newnode = self.__class__(self.rawsource, **self.attributes)
if isinstance(self, nodes.Element):
newnode.source = self.source
newnode.line = self.line
return newnode
nodes.Element.copy = _new_copy # type: ignore

which now relies on docutils copy function which also copies _document` property:
https://github.com/docutils/docutils/blob/bc9bf5fc2c7f905507a49e8e37c12368c2f4a0cc/docutils/docutils/nodes.py#L1056-L1061

If I add copying of _document to the _new_copy function, I get the very same memory hog.

@AA-Turner
Copy link
Member

I have released v6.1.3 which should fix this.

A

@marxin
Copy link
Contributor Author

marxin commented Jan 10, 2023

Thanks for the reversion. Should we keep this issue open for a proper fix in docutils project? Or should I close it?

@jfbu
Copy link
Contributor

jfbu commented Jan 10, 2023

I will close the issue for time being but we can always reopen at later date.

The fix happened at dcb4429 and was merged into 6.1.3.

The original removal of the monkeypatch of DocUtils happened at 080517c from #10470 which was part of the 6.0.0 release. (as @marxin mentioned in original report, thanks!)

@jfbu jfbu closed this as completed Jan 10, 2023
@jfbu jfbu added this to the 6.1.3 milestone Jan 10, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants