cd31b907c3
We're seeing noise like the following in doc builds: /foo/.tox/docs/lib/python3.9/site-packages/docutils/statemachine.py:707: ResourceWarning: unclosed file <_io.BufferedReader name='/foo/.git/objects/pack/pack-dd69481843ca1b7377f2f109b0022221437aca20.pack'> if not hasattr(pattern, 'match'): ResourceWarning: Enable tracemalloc to get the object allocation traceback Enable tracemalloc for Sphinx gives us the 'Loader' as the root cause: $ python -W all::ResourceWarning -X tracemalloc=100 -m sphinx.cmd.build ... ... File "/foo/.tox/docs/lib/python3.9/site-packages/reno/sphinxext.py", lineno 114 ldr = loader.Loader(conf) File "/foo/.tox/docs/lib/python3.9/site-packages/reno/loader.py", lineno 63 self._load_data() ... (you could also use PYTHONTRACEMALLOC and PYTHONWARNINGS env vars) Following this thread, it appears 'reno.scanner.Scanner' creates an instance of 'dulwich.repo.Repo', however, it fails to close it [1]. The 'reno.loader.Loader' uses 'Scanner', meaning this also leaves around open files. The solution is simple: add a 'close()' method to both the 'Scanner' and 'Loader', and provide the necessary '__enter__' and '__exit__' magic methods to use it as a context manager, like the 'Repo' object itself supports. [1] https://www.dulwich.io/docs/api/dulwich.repo.html#dulwich.repo.Repo.close Change-Id: I0b9776f431cf902a9ace5d52961eb77caaae8eaa Signed-off-by: Stephen Finucane <stephenfin@redhat.com> |
||
---|---|---|
.. | ||
add-closed-branch-config-options-8773caf240e4653f.yaml | ||
add-config-file-e77084792c1dc695.yaml | ||
add-deprecations-section-6b0f118fe190585c.yaml | ||
add-earliest-version-6f3d634770e855d0.yaml | ||
add-linter-ce0a861ade64baf2.yaml | ||
add-verbose-flag-88d72cb01812c616.yaml | ||
allow-short-branch-names-61a35be55f04cea4.yaml | ||
avoid-clashing-uids-e84ffe8132ce996d.yaml | ||
branches-eol-bcafc2a007a1eb9f.yaml | ||
bug-1537451-f44591da125ba09d.yaml | ||
cache-ordering-6c743f68e3f7107f.yaml | ||
cache-scan-all-branches-a935824a844d1d9f.yaml | ||
collapse-pre-releases-0b24e0bab46d7cf1.yaml | ||
config-option-branch-name-re-8ecfe93195b8824e.yaml | ||
config-option-sections-9c68b070698e984a.yaml | ||
custom-tag-versions-d02028b6d35db967.yaml | ||
default-repository-root-cli-85d23034bef81619.yaml | ||
drop-python-2-7-73d3113c69d724d6.yaml | ||
dulwich-rewrite-3a5377162d97402b.yaml | ||
Enable-using-tempalte-file-be734d8698309409.yaml | ||
file-encoding-option-6aa3e32f2bf830b8.yaml | ||
first-release-2857bfc9474c00b4.yaml | ||
fix-branch-base-detection-95300805f26a0c15.yaml | ||
fix-cli-option-handling-a13652d14507f2d7.yaml | ||
fix-delete-handling-55232c50b647aa57.yaml | ||
fix-git-log-ordering-0e52f95f66c8db5b.yaml | ||
fix-prelude-4e0bcb6f76571b4f.yaml | ||
fix-scanner-tag-detection-ef0a95c12a90f167.yaml | ||
fix-sphinxext-scanner-0aa012ada66db773.yaml | ||
flexible-formatting-31c8de2599d3637d.yaml | ||
ignore-notes-option-9d0bde540fbcdf22.yaml | ||
ignore-null-merges-56b7a8ed9b20859e.yaml | ||
include-working-copy-d0aed2e77bb095e6.yaml | ||
keep-scanning-past-branchpoint-61f72023c32cf0b3.yaml | ||
log-levels-and-sphinx-161-6efe0d291718a657.yaml | ||
no-show-source-option-ee02766b26fe53be.yaml | ||
null-merge-infinite-loop-670367094ad83e19.yaml | ||
optional-oslosphinx-55843a7f80a14e58.yaml | ||
reference-name-mangling-3c845ebf88af6944.yaml | ||
release-date-3a1dec42c91a3f0b.yaml | ||
repodir-config-file-b6b8edc2975964fc.yaml | ||
report-title-option-f0875bfdbc54dd7b.yaml | ||
reverse-slug-order-4c5f94e72d4f6fb9.yaml | ||
scanner-change-96682cb04fc66c0b.yaml | ||
scanner-loader-context-managers-5d80d95dc3d33fe0.yaml | ||
semver-next-63c68cf10ec91f09.yaml | ||
setuptools-integration-950bd8ab6d2970c7.yaml | ||
show-less-unreleased-802781a1a3bf110e.yaml | ||
show-note-filename-in-report-a1118c917588b58d.yaml | ||
sphinx-extension-4a092b4102370246.yaml | ||
sphinx-with-tarballs-d3215fc6831c3516.yaml | ||
stable-section-anchors-d99258b6df39c0fa.yaml | ||
stop-scanning-branch-e5a8937c248acc99.yaml | ||
stop-scanning-branch-option-6a0156b183814d7f.yaml | ||
support-custom-template-0534a2199cfec44c.yaml | ||
support-edit-ec5c01ad6144815a.yaml | ||
support-multi-line-notes-328853d8d596fd64.yaml | ||
tag-format-bd5018a813c804fd.yaml | ||
unreleased-version-title-86751f52745fd3b7.yaml | ||
validate-note-files-1cdbdcde9ae7829b.yaml |