I can reproduce this with sftp:// URLs, but not bzr:// or bzr+ssh://.
For SFTP, the issue seems to be the subprocess management: nothing causes the /usr/bin/ssh processes to be terminated after the last reference to the SFTP connection goes away, so the stdin and stderr pipes linger indefinitely for each connection (hence the 2 fds leaked per open). I have a branch that fixes this.
I can reproduce this with sftp:// URLs, but not bzr:// or bzr+ssh://.
For SFTP, the issue seems to be the subprocess management: nothing causes the /usr/bin/ssh processes to be terminated after the last reference to the SFTP connection goes away, so the stdin and stderr pipes linger indefinitely for each connection (hence the 2 fds leaked per open). I have a branch that fixes this.