You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Brandon Chubb <bf...@verizon.net> on 2006/10/30 01:09:31 UTC

Perl bindings using up descriptors

Using SVN 1.1.4 with some simple calls using the Perl bindings, I eventually
run out of descriptors.  I can see with lsof that a large number of TCP
connections stay open.

Has anyone run into this before?  I'm not going to doubt that I'm doing
something wrong, but having gone through the SVN::Client and SVN::Core
manuals, I certainly don't see anything promising to fix things.  If I use a
tiny test program and the debugger, I can see the TCP connection count
increase with almost every SVN call.

-bc

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Perl bindings using up descriptors

Posted by bf...@verizon.net.
Absolutely right, the other thread "Repeated operations with perl bindings.."
covered this as well.

I'm now doing this to initiate:

$pool = SVN::Pool->new_default;
$ctx->pool($pool);

..and periodically doing this to start a new pool..

undef $pool;
$pool = SVN::Pool->new_default;
$ctx->pool($pool);

I doubt the undef is necessary. 

Thanks!

On Mon, 6 Nov 2006, Garrett Rooney wrote:

> On 10/31/06, bfc0713@verizon.net <bf...@verizon.net> wrote:
> 
> > Fair enough.  It's just that the code to reproduce the problem is so
> > simple, it seems that someone else may have hit it.  My real code
> > to load up subversion is a little more involved of course.  But it
> > still sets up no callbacks for logging, going through checkin results, etc.
> >
> > The code below will show one connection after the checkout, and 2
> > after the checkin.  Anything talking to the repository will add another
> > connection (until I'm out of descriptors).
> 
> If I had to guess I'd say the problem is that you're allocating
> everything in the Perl binding's default pool, so it won't get cleaned
> up until the process exits.  If you start using subpools that should
> help.
> 
> -garrett
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Perl bindings using up descriptors

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 10/31/06, bfc0713@verizon.net <bf...@verizon.net> wrote:

> Fair enough.  It's just that the code to reproduce the problem is so
> simple, it seems that someone else may have hit it.  My real code
> to load up subversion is a little more involved of course.  But it
> still sets up no callbacks for logging, going through checkin results, etc.
>
> The code below will show one connection after the checkout, and 2
> after the checkin.  Anything talking to the repository will add another
> connection (until I'm out of descriptors).

If I had to guess I'd say the problem is that you're allocating
everything in the Perl binding's default pool, so it won't get cleaned
up until the process exits.  If you start using subpools that should
help.

-garrett

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Perl bindings using up descriptors

Posted by bf...@verizon.net.
On Tue, 31 Oct 2006, Garrett Rooney wrote:

> On 10/29/06, Brandon Chubb <bf...@verizon.net> wrote:
> > Using SVN 1.1.4 with some simple calls using the Perl bindings, I eventually
> > run out of descriptors.  I can see with lsof that a large number of TCP
> > connections stay open.
> >
> > Has anyone run into this before?  I'm not going to doubt that I'm doing
> > something wrong, but having gone through the SVN::Client and SVN::Core
> > manuals, I certainly don't see anything promising to fix things.  If I use a
> > tiny test program and the debugger, I can see the TCP connection count
> > increase with almost every SVN call.
> 
> Well, if you don't include an example of what your code is doing, it's
> rather difficult to speculate about what might be wrong with it.

Fair enough.  It's just that the code to reproduce the problem is so
simple, it seems that someone else may have hit it.  My real code
to load up subversion is a little more involved of course.  But it
still sets up no callbacks for logging, going through checkin results, etc.

The code below will show one connection after the checkout, and 2
after the checkin.  Anything talking to the repository will add another
connection (until I'm out of descriptors).

---------
#!/usr/bin/perl 

use SVN::Core;
use SVN::Client;

*WORKDIR = \"/some/work/dir";
*REPO = \"svn://somehost/somerepo";

# callback for authentication
sub simple_prompt {
  my ($cred,$realm,$default_username,$may_save,$pool) = @_;
  $cred->username('username');
  $cred->password('password');
}

$mypid = $$;
my $ctx = new SVN::Client(auth =>
	[SVN::Client::get_simple_provider(),
	SVN::Client::get_simple_prompt_provider(\&simple_prompt,2),
	SVN::Client::get_username_provider()]);
chdir($WORKDIR);
$ctx->checkout($REPO, $WORKDIR, "HEAD", 1);
print "Done with checkout, connections:\n";
system("lsof -p $mypid | grep TCP");
`echo blah > test.txt`;
$ctx->add("test.txt",0);
$ctx->commit("test.txt", 0);
print "Done with commit, connections:\n";
system("lsof -p $mypid | grep TCP");
print "Done.\n";

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Perl bindings using up descriptors

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 10/29/06, Brandon Chubb <bf...@verizon.net> wrote:
> Using SVN 1.1.4 with some simple calls using the Perl bindings, I eventually
> run out of descriptors.  I can see with lsof that a large number of TCP
> connections stay open.
>
> Has anyone run into this before?  I'm not going to doubt that I'm doing
> something wrong, but having gone through the SVN::Client and SVN::Core
> manuals, I certainly don't see anything promising to fix things.  If I use a
> tiny test program and the debugger, I can see the TCP connection count
> increase with almost every SVN call.

Well, if you don't include an example of what your code is doing, it's
rather difficult to speculate about what might be wrong with it.

-garrett

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org