RE: [Ssh-sftp-perl-users] Net::SFTP Patch
Brought to you by:
dbrobins
From: David R. <dr...@at...> - 2004-12-22 17:57:44
|
> From: ssh...@li... > [mailto:ssh...@li...]On Behalf Of > Robert Landrum > Sent: Wednesday, December 22, 2004 11:10 AM > Subject: [Ssh-sftp-perl-users] Net::SFTP Patch >=20 > It came to my attention that Bricolage which uses Net::SFTP=20 > was leaving sshd connections open. The Bric dev guys were doing a = undef=20 > $sftp; to close the connection, but that wasn't sufficient to close = the=20 > connection. And with apache not exiting at the end of the request = cycle to force the=20 > connection closed, our server quickly ran out of open file handles. undef'ing the object works fine for me - would you happen to be using a = version of perl earlier than 5.6? I know with 5.005003 it's easy to = leak handles. > I've added a close_connection method to the Net::SFTP module, and = thought > that others might have use for such a method. I also added a DESTROY > method, which I don't think necessarily belongs, but which I added = just > so I wouldn't have to muck with the Bric code too... I'm not the maintainer, but it might be preferable to find out why = undef'ing fails before adding code. Ideally undef'ing drops the refcount to zero, which destroys the = Net::SFTP object, which cascades to the Net::SSH::Perl and its = sub-objects and eventually the socket is closed. > Robert Landrum > Systems Programmer --=20 Dave Isa. 40:31 |