From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 6FC391FA57 for ; Tue, 17 Oct 2023 23:38:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1697585900; bh=KGhQ+c9NYSQ2cSsiNVwFIozi7M6GudonymM3rz26lrs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yGOcCzDfrHSo7YyIHJAzbkSXs2qT0EX2OG0RptY02b04Z5Ac9Uk9EzGbRQBtKx4A/ IEmFfL2W6xpRHEMDVkS6kX1aRpg9v0SIhbFq4PfwhIL5mNgLQyPo8/8EMFqElqFvdz IahtPTtuV/5pcLkdM/CMSOF09s8Q0PHJubEsLJsE= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 25/30] xt/mem-imapd-tls: reduce FDs for lsof use Date: Tue, 17 Oct 2023 23:38:10 +0000 Message-ID: <20231017233815.1637932-26-e@80x24.org> In-Reply-To: <20231017233815.1637932-1-e@80x24.org> References: <20231017233815.1637932-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We need some pipes in our parent process to capture the output of lsof(1), so give us some more padding for temporary FDs. --- xt/mem-imapd-tls.t | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xt/mem-imapd-tls.t b/xt/mem-imapd-tls.t index bb2f6c35..53adb11b 100644 --- a/xt/mem-imapd-tls.t +++ b/xt/mem-imapd-tls.t @@ -6,6 +6,7 @@ use strict; use v5.10.1; use Socket qw(SOCK_STREAM IPPROTO_TCP SOL_SOCKET); +use PublicInbox::Spawn qw(which); use PublicInbox::TestCommon; use PublicInbox::DS; require_mods(qw(-imapd)); @@ -71,7 +72,7 @@ if ($TEST_TLS) { $ssl_opt{SSL_startHandshake} = 0; } chomp(my $nfd = `/bin/sh -c 'ulimit -n'`); -$nfd -= 10; +$nfd -= 20; ok($nfd > 0, 'positive FD count'); my $MAX_FD = 10000; $nfd = $MAX_FD if $nfd >= $MAX_FD; @@ -118,10 +119,11 @@ if ($DONE != $nfd) { PublicInbox::DS::event_loop(); } is($nfd, $DONE, "$nfd/$DONE done"); -if ($^O eq 'linux' && open(my $f, '<', "/proc/$pid/status")) { +my $lsof = which('lsof'); +if ($^O eq 'linux' && $lsof && open(my $f, '<', "/proc/$pid/status")) { diag(grep(/RssAnon/, <$f>)); - diag " SELF lsof | wc -l ".`lsof -p $$ |wc -l`; - diag "SERVER lsof | wc -l ".`lsof -p $pid |wc -l`; + diag " SELF lsof | wc -l ".`$lsof -p $$ |wc -l`; + diag "SERVER lsof | wc -l ".`$lsof -p $pid |wc -l`; } PublicInbox::DS->Reset; $td->kill;