user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [RFC] t/git-http-backend: add MANY_CLONE test
@ 2019-09-13  1:50 Eric Wong
  2019-09-13  8:57 ` [RFC 2/1] t/git-http-backend: disable worker processes Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2019-09-13  1:50 UTC (permalink / raw)
  To: meta

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;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [RFC 2/1] t/git-http-backend: disable worker processes
  2019-09-13  1:50 [RFC] t/git-http-backend: add MANY_CLONE test Eric Wong
@ 2019-09-13  8:57 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2019-09-13  8:57 UTC (permalink / raw)
  To: meta

We want to ensure we run lsof(8) on the worker, and not the
master, which doesn't serve requests.
---
 t/git-http-backend.t | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/git-http-backend.t b/t/git-http-backend.t
index d9b33bad..7d10c720 100644
--- a/t/git-http-backend.t
+++ b/t/git-http-backend.t
@@ -44,7 +44,7 @@ my $get_maxrss = sub {
 
 {
 	ok($sock, 'sock created');
-	my $cmd = [ $httpd, "--stdout=$out", "--stderr=$err", $psgi ];
+	my $cmd = [ $httpd, '-W0', "--stdout=$out", "--stderr=$err", $psgi ];
 	ok(defined($pid = spawn_listener(undef, $cmd, [$sock])),
 	   'forked httpd process successfully');
 }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-13  8:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-13  1:50 [RFC] t/git-http-backend: add MANY_CLONE test Eric Wong
2019-09-13  8:57 ` [RFC 2/1] t/git-http-backend: disable worker processes Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).