This repository was archived by the owner on Sep 20, 2018. It is now read-only.

Description
I've encountered a situation where pushy is leaking an open file descriptor (shows up as pipe under lsof) when the connection is closed. I think I've tracked it down to connection.server.stderr. I'm seeing this on Linux, so I'm not sure it applies everywhere. This is the simplest example I could come up with to illustrate (relies on psutil).
import sys
import pushy
import psutil
import os
proc = psutil.Process(os.getpid())
before = proc.get_num_fds()
conn = pushy.connect('local:', python=sys.executable)
conn.close()
after = proc.get_num_fds()
print "open/close - handles leaked: %d" % (after - before)
before = proc.get_num_fds()
conn = pushy.connect('local:', python=sys.executable)
conn.server.stderr.close()
conn.close()
after = proc.get_num_fds()
print "open/close stderr/close - handles leaked: %d" % (after - before)
output:
open/close - handles leaked: 1
open/close stderr/close - handles leaked: 0