Skip to content
This repository has been archived by the owner on Sep 20, 2018. It is now read-only.

Pipes leaking on connection close() #48

Open
jpenney opened this issue Oct 25, 2013 · 1 comment
Open

Pipes leaking on connection close() #48

jpenney opened this issue Oct 25, 2013 · 1 comment

Comments

@jpenney
Copy link

jpenney commented Oct 25, 2013

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
@axw
Copy link
Member

axw commented Oct 25, 2013

Thanks for reporting the issue and the repro. I'm away for work at the moment, so won't get to this for a bit. If you end up with a fix before me, please do send through a pull request.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants