user/dev discussion of public-inbox itself
 help / color / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [RFC] t/git-http-backend: add MANY_CLONE test
Date: Fri, 13 Sep 2019 01:50:43 +0000
Message-ID: <20190913015043.17149-1-e@80x24.org> (raw)

Not a final test and I don't think I'll put this into master,
but it could help find some bugs in GitHTTPBackend, HTTPD/Async
or Qspawn code affecting lore.

Using GIANT_GIT_DIR=/path/to/git.git and MANY_CLONE=1, I'm
unable to find lingering FDs in lsof(8) output which is
dumped via diag.
---
 t/git-http-backend.psgi |  5 +++++
 t/git-http-backend.t    | 15 ++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/t/git-http-backend.psgi b/t/git-http-backend.psgi
index ed70d501..0ac690ba 100644
--- a/t/git-http-backend.psgi
+++ b/t/git-http-backend.psgi
@@ -9,6 +9,11 @@ use Plack::Builder;
 use BSD::Resource qw(getrusage);
 my $git_dir = $ENV{GIANT_GIT_DIR} or die 'GIANT_GIT_DIR not defined in env';
 my $git = PublicInbox::Git->new($git_dir);
+
+# I don't have enough memory to use the default 32 process limiter:
+my $small_limiter = PublicInbox::Qspawn::Limiter->new(2);
+$git->{-httpbackend_limiter} = $small_limiter;
+
 builder {
 	enable 'Head';
 	sub {
diff --git a/t/git-http-backend.t b/t/git-http-backend.t
index 1d9bb9f3..d9b33bad 100644
--- a/t/git-http-backend.t
+++ b/t/git-http-backend.t
@@ -82,7 +82,7 @@ SKIP: {
 	}
 }
 
-{
+unless ($ENV{MANY_CLONE}) {
 	my $c = fork;
 	if ($c == 0) {
 		setsid();
@@ -112,6 +112,19 @@ SKIP: {
 	ok($diff < 2048, 'no bloating caused by slow smart client');
 }
 
+if ($ENV{MANY_CLONE}) {
+	system(<<EOF);
+	for i in a b c d
+	do
+		git clone --mirror http://$host:$port/ $tmpdir/dst-\$i &
+	done
+	wait
+EOF
+
+	my @lsof = `lsof -p $pid`;
+	diag join('', @lsof);
+}
+
 {
 	ok(kill('TERM', $pid), 'killed httpd');
 	$pid = undef;

             reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13  1:50 Eric Wong [this message]
2019-09-13  8:57 ` [RFC 2/1] t/git-http-backend: disable worker processes Eric Wong

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190913015043.17149-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror http://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.org/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox