From: Stephen B. <st...@br...> - 2003-01-06 17:24:33
|
On Monday 06 January 2003 14:58, Chris Ridd wrote: > On 6/1/03 1:25 pm, Stephen Brandon <st...@br...> > wrote: > > So, why aren't the sockets being closed? Is this supposed to happen via > > garbage collection? If so, the process of creating a new perl-ldap > > instance in $ldap seems not to be triggering GC in my case... > > > > As far as I can see I am not creating any other references to $ldap > > itself, though I am caching arrays of strings returned from the search > > results - but I don't imagine this creates references to $ldap. > > Search result objects (Net::LDAP::Search) have parent references to the > $ldap object that created them ($res->parent). I don't think the Entry > objects themselves have this parent reference. What precisely are you > caching from the search results? ok, I have just made the search results into a "my" variable so they do not get remembered between sessions - no effect. I am not caching these search result objects at all. The individual entries are parsed to get the attribute and value strings, and I simply keep a big array/hash of these values. So I don't think they would be the problem. > > To fix this for the time being, after getting the Connection Reset error > > I (i) call $ldap->unbind, and (ii) close $ldap->socket() > > > > This seems to stop the file descriptor problem, but I am concerned that > > there may be a larger scale memory leak going on. > > > > - Can anyone shed any light on this? > > - Should there be some other method in perl-ldap that does a more > > thorough, explicit cleanup? > > This all ought to happen when the Net::LDAP object is destroyed, eg it goes > out of scope. Try adding a Net::LDAP::DESTROY method to see when (if!) it > gets called. Will do. Cheers, Stephen |