Skip to content

Commit 9b37592

Browse files
committed
pyln-testing: Fix BitcoinD fd leak
1 parent c5fc1b5 commit 9b37592

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
55

6+
## [Unreleased]
7+
8+
### Added
9+
10+
- pyln-testing: Fix FD leaks in BitcoinD. ([#7130])
611

712
## [24.08] - 2024-08-28: "Steel Backed-up Channels"
813

contrib/pyln-testing/pyln/testing/fixtures.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ def bitcoind(directory, teardown_checks):
164164
bitcoind.proc.kill()
165165
bitcoind.proc.wait()
166166

167+
bitcoind.cleanup_files()
168+
167169

168170
class TeardownErrors(object):
169171
def __init__(self):

contrib/pyln-testing/pyln/testing/utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,14 @@ def kill(self):
256256
self.proc.kill()
257257
self.proc.wait()
258258

259+
def cleanup_files(self):
260+
"""Ensure files are closed."""
261+
for f in ["stdout_write", "stderr_write", "stdout_read", "stderr_read"]:
262+
try:
263+
getattr(self, f).close()
264+
except Exception:
265+
pass
266+
259267
def logs_catchup(self):
260268
"""Save the latest stdout / stderr contents; return true if we got anything.
261269
"""

0 commit comments

Comments
 (0)