Date: | Tue, 6 May 2003 10:19:00 +0100 |
From: | Graham Barr <gbarr [...] pobox.com> |
To: | bug-perl-ldap [...] rt.cpan.org |
Subject: | [Fwd] Re: Sockets leaking? |
----- Forwarded message from Graham Barr <gbarr@pobox.com> -----
Date: Mon, 6 Jan 2003 21:14:43 +0000
To: Stephen Brandon <stephen@brandonitconsulting.co.uk>
From: Graham Barr <gbarr@pobox.com>
Subject: Re: Sockets leaking?
this reply is private, but please keep discussion on the list
On Mon, Jan 06, 2003 at 08:47:17PM +0000, Stephen Brandon wrote:
Show quoted text
> On Monday 06 January 2003 20:37, you wrote:
Net::LDAP should manage the data structures so that there are no leaks. It
seems there is a case when it can be left in a bad state, causing a leak.
I need to try to avoid this, or find another solution. I dont really want
to use weak references a they do not exist in older perls which some users
of Net::LDAP still use.
Graham.
Show quoted text> > On Mon, Jan 06, 2003 at 08:22:27PM +0000, Stephen Brandon wrote:
>
> Graham,
>
> I'm not completely certain what you mean by "should be managed" above -- do
> you mean that you thought that it was working properly, or that "oops, we
> should have thought of that - we should do that"? :-)
> > > I think I have found the bug -- see below.
> > >
> > > YES -- that's it -- it's the "message" hashes held in ::LDAP objects that
> > > have the parent references. If these messages are still contained in the
> > > object, then it won't automatically be destroyed.
> > >
> > > I had to do the following after finishing with an LDAP object:
> > >
> > > $ldap->{net_ldap_mesg} = "";
> >
> > Yes that is one place that reference loops are kept, but thay should be
> > managed to not create problems. It does seem there are some cases where the
> > loops could be left, preventing DESTROY being called. I will see what can
> > be done, but it may be that we add a disconnect method that will ensure the
> > connection is closed and all cleenup done.
>
> In any case, the situation for me manifested when the "message" was an error
> message, eg:
>
> $VAR1 = bless( {
> 'net_ldap_async' => 0,
> 'net_ldap_resp' => {},
> 'net_ldap_mesg' => {
> '2' => bless( {
> 'callback' => undef,
> 'parent' => $VAR1,
> 'mesgid' => '2',
> 'errorMessage' => 'I/O
> Error Connection reset by peer ',
> 'resultCode' => '1',
> 'pdu' => '0gcbo=ku
>
> £
Show quoted text> cn163680>dncn
> objectClasssn givenNaminitialfullNamemail'
> }, 'Net::LDAP::Search' )
> },
> 'net_ldap_debug' => 0,
> 'net_ldap_host' => 'ldapserver.foo.com',
> 'net_ldap_onerror' => sub { "DUMMY" },
> 'net_ldap_version' => 2,
> 'net_ldap_socket' => bless( \*Symbol::GEN1,
> 'IO::Socket::INET' )
> }, 'Net::LDAP' );
>
>
> It may or may not have happened after getting a normal response from a
> server. I don't know.
>
> Anyway, I hope all this helps.
>
> Cheers,
> Stephen Brandon
----- End forwarded message -----