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

Pipes leaking on connection close() #48

@jpenney

Description

@jpenney

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions