AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 28 Bitcoin

pyln-client: don't leak dirfd after connecting Unix socket

Public commit record

What the developer wrote

Authored by Matt Whitlock

95/100 · Strong
pyln-client: don't leak dirfd after connecting Unix socket

This file descriptor leak was causing test failures due to exceeding the
limit on open file descriptors. Note that the leak only occurred if the
RPC socket path was longer than can fit in a struct sockaddr_un.

Changelog-Fixed: pyln-client no longer leaks a file descriptor when connecting to an RPC socket with a long path name.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit fixes a file descriptor leak in the Python client library used to talk to Core Lightning. When connecting to a Unix socket whose path was too long, the code opened a temporary directory file descriptor but never closed it. Over time this could exhaust the process's allowance of open files, causing test failures or potentially disrupting normal operation. The fix wraps the socket connection in a try/finally block so the temporary descriptor is always closed.

Recommended action

Upgrade pyln-client to a version containing this commit. If upgrading is not possible, avoid using RPC socket paths longer than the platform's AF_UNIX limit, or monitor and restart client processes before file descriptor limits are exhausted.

Security signals we found

01

Resource exhaustion via unclosed file descriptor

02

Condition triggered only by long Unix socket paths

03

Fix uses try/finally to guarantee descriptor cleanup

Risk score

Why this scored 28/100

Our methodology →
Potential impact 4/30
Exploitability 3/25
Stealth signal 5/15
Affected reach 4/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.