pyln-testing: close log files when tearing down node_factory
What changed, and why it matters
This is a small cleanup change in the Python testing helper for Core Lightning. It makes sure log files are closed when test nodes are torn down, preventing file descriptor leaks during automated tests. There is no security relevance in the commit itself.
No security action needed. Treat as routine test-framework hygiene.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch adds a loop in the node_factory teardown fixture that calls n.daemon.cleanup_files() for each node. TailableProc.cleanup_files() closes the process’s log file handles. This fixes a resource leak in the test framework only; it does not change production node behavior, network handling, cryptography, or any privileged operation.
Changed components
contrib/pyln-testing/pyln/testing/fixtures.pyInspect captured patch +3 / −0
diff --git a/contrib/pyln-testing/pyln/testing/fixtures.py b/contrib/pyln-testing/pyln/testing/fixtures.py
index 215c5402..7bc45a25 100644
--- a/contrib/pyln-testing/pyln/testing/fixtures.py
+++ b/contrib/pyln-testing/pyln/testing/fixtures.py
@@ -512,6 +512,9 @@ def node_factory(request, directory, test_name, bitcoind, executor, db_provider,
if not ok:
map_node_error(nf.nodes, prinErrlog, "some node failed unexpected, non-empty errlog file")
+ for n in nf.nodes:
+ n.daemon.cleanup_files()
+
def getErrlog(node):
for error_file in os.listdir(node.daemon.lightning_dir):
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.