-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Environment
node24
Reproduction
none
Describe the bug
While investigating a memory leak related to Conn, I found that ImportClient appears to strongly retain Conn, preventing it from being garbage collected in Node.js.
During testing, explicitly breaking the reference from ImportClient back to Conn allows both Conn and higher-level objects to be released:
Object.values(conn.imports).forEach(v => {
delete v.rc._client.conn;
});After this, heap snapshots no longer show Conn or related objects.
This suggests that there is a strong reference cycle involving:
Conn -> imports -> RefCount -> ImportClient -> Conn
I’m not deeply familiar with the intended lifecycle semantics of this library, but this reference chain seems to make it difficult (or impossible) for Conn to be GC’d under normal shutdown, even after closing the transport.
I hope this observation helps narrow down the issue.
Please let me know if a minimal reproduction or heap snapshot would be useful.
Additional context
No response