Re: [Ssh-sftp-perl-users] Net::SFTP Patch
Brought to you by:
dbrobins
From: Robert L. <rla...@ao...> - 2004-12-22 19:54:37
|
On Wed, Dec 22, 2004 at 12:57:29PM -0500, David Robins wrote: > 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. > From a perl script it should work fine. From mod_perl, it doesn't. We're using 5.6.1. > 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. > The refcount doesn't reach zero. Because Socket is used, and because Socket does the gensym call, the reference created from the resulting file handle, when collected, doesn't release the symbol. As I recall, it has something to due with scope, but my memory is hazy. All this is done within Net::SSH::Perl. An explicit close needs to be called on the filehandle (which I don't think is happening) in order for it to correctly close the socket because apache/mod_perl process will never (or rarely) garbage collect it. At least that's my theory. Rob -- Robert Landrum Systems Programmer |