🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: muc.lists.freebsd.fs
Article #12

Re: Terminal number of files in a ZFS directory.

#12
From: Zaphod Beeblebrox
Date: Tue, 20 Oct 2026 04:43
110 lines
11128 bytes
--0000000000004fa67d065e3e4670
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Ok... first, on the shell.  Echo can handle absurd amounts of data.  Try
"echo `cat file`" sometime.  The limitation on argument length is on the
launching of a new process, not in the shell itself.  I have never run into
a limitation on the shell argument parsing.  Certainly you can do stuff
like "echo * | xargs rm" just fine... even though "rm *" wouldn't work.

That-all-said, the bash process never grows beyond 25M.  The ARC gets large
--- I'm sure this is ZFS dying.  Once I run the echo * command, even the
parent directory of the problem directory can't be listed.

On Mon, Oct 19, 2026 at 6:00=E2=80=AFPM Bakul Shah <bakul@iitbombay.org> wr=
ote:

>
> On Oct 18, 2026, at 4:58=E2=80=AFPM, Zaphod Beeblebrox <zbeeble@gmail.com=
> wrote:
> >
> >
> > On the jail server, the zfs filesystem only occupies about 10G.  echo *
> on the directory runs at 100% cpu for over a week.  So I reboot (to stop
> it... it's stuck in kernel) and zfs send it to a NVME only system (my
> desktop) and try again.  I was thinking that much faster disk could
> compensate for abominably bad big-O behavior.  But this two ran for a wee=
k
> without finishing.
>
> See if =E2=80=9Cfind -f .=E2=80=9D in the directory completes. That =E2=
=80=9C-f=E2=80=9D
> avoids sorting dir entries.  What may be happening is in
> =E2=80=9Cecho *=E2=80=9D the (implicit) sorting of filenames will require
> buffering up all the names possibly resulting in swapping.
> Check if swap use is increasing. Also do =E2=80=9Cls -ld .=E2=80=9D to se=
e
> dir space use. You can also check process memory use while
> "echo *" is churning away.


so echo * itself isn't a problem (see above).  The zfs filesystem causing
the problem becomes more and more inoperative.  After some time the parent
of the parent of the problem can't be listed.  Other zfs filesystems on the
host continue to work, tho.

And this machine has 384G of RAM on it.

In terms of find and friends, any access to the directory locks the process
in D-state.  If it was any problem sorting, the shell would be killable
(it's not).  In fact, I found this problem directory because the daily
finds were going there to die.  "du" also locks it up.

--0000000000004fa67d065e3e4670
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Ok... first, on the shell.=C2=A0 Echo can handle absu=
rd amounts of data.=C2=A0 Try &quot;echo `cat file`&quot; sometime.=C2=A0 T=
he limitation on argument length is on the launching of a new process, not =
in the shell itself.=C2=A0 I have never run into a limitation on the shell =
argument parsing.=C2=A0 Certainly you can do stuff like &quot;echo * | xarg=
s rm&quot; just fine... even though &quot;rm *&quot; wouldn&#39;t work.</di=
v><div><br></div><div>That-all-said, the bash process never grows beyond 25=
M.=C2=A0 The ARC gets large --- I&#39;m sure this is ZFS dying.=C2=A0 Once =
I run the echo * command, even the parent directory of the problem director=
y can&#39;t be listed.</div><br><div class=3D"gmail_quote gmail_quote_conta=
iner"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Oct 19, 2026 at 6:00=E2=
=80=AFPM Bakul Shah &lt;<a href=3D"mailto:bakul@iitbombay.org">bakul@iitbom=
bay.org</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"=
margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-lef=
t:1ex"><br>
On Oct 18, 2026, at 4:58=E2=80=AFPM, Zaphod Beeblebrox &lt;<a href=3D"mailt=
o:zbeeble@gmail.com" target=3D"_blank">zbeeble@gmail.com</a>&gt; wrote:<br>
&gt; <br>
&gt; <br>
&gt; On the jail server, the zfs filesystem only occupies about 10G.=C2=A0 =
echo * on the directory runs at 100% cpu for over a week.=C2=A0 So I reboot=
 (to stop it... it&#39;s stuck in kernel) and zfs send it to a NVME only sy=
stem (my desktop) and try again.=C2=A0 I was thinking that much faster disk=
 could compensate for abominably bad big-O behavior.=C2=A0 But this two ran=
 for a week without finishing.<br>
<br>
See if =E2=80=9Cfind -f .=E2=80=9D in the directory completes. That =E2=80=
=9C-f=E2=80=9D<br>
avoids sorting dir entries.=C2=A0 What may be happening is in<br>
=E2=80=9Cecho *=E2=80=9D the (implicit) sorting of filenames will require<b=
r>
buffering up all the names possibly resulting in swapping.<br>
Check if swap use is increasing. Also do =E2=80=9Cls -ld .=E2=80=9D to see<=
br>
dir space use. You can also check process memory use while<br>
&quot;echo *&quot; is churning away.</blockquote><div><br></div><div>so ech=
o * itself isn&#39;t a problem (see above).=C2=A0 The zfs filesystem causin=
g the problem becomes more and more inoperative.=C2=A0 After some time the =
parent of the parent of the problem can&#39;t be listed.=C2=A0 Other zfs fi=
lesystems=C2=A0on the host continue to work, tho.</div><div><br></div><div>=
And this machine has 384G of RAM on it.</div><div><br></div><div>In terms o=
f find and friends, any access to the directory locks the process in D-stat=
e.=C2=A0 If it was any problem sorting, the shell would be killable (it&#39=
;s not).=C2=A0 In fact, I found this problem directory because the daily fi=
nds were going there to die.=C2=A0 &quot;du&quot; also locks it up.=C2=A0</=
div></div></div>

--0000000000004fa67d065e3e4670--


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID: <CACpH0McEK265et4HV0eJeQPT8FD0Rj_-8=KOnVCbFoTaS5yGug@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail
References: <2465EDDD-2138-4E90-8058-33D9E1A1B326@iitbombay.org> <>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: Zaphod Beeblebrox <zbeeble@gmail.com>
Newsgroups: muc.lists.freebsd.fs
Subject: Re: Terminal number of files in a ZFS directory.
Date: Tue, 20 Oct 2026 00:43:28 -0400
Organization: Newsgate at muc.de e.V.
Sender: owner-freebsd-fs@FreeBSD.org
Approved: news-admin@muc.de
Distribution: world
Message-ID: <CACpH0McEK265et4HV0eJeQPT8FD0Rj_-8=KOnVCbFoTaS5yGug@mail.gmail.com>
References: <2465EDDD-2138-4E90-8058-33D9E1A1B326@iitbombay.org> <>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="0000000000004fa67d065e3e4670"
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
	logging-data="51458"; mail-complaints-to="news-admin@muc.de"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1792471440; h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:cc:mime-version:mime-version:
	 content-type:content-type:in-reply-to:in-reply-to:
	 references:references:list-id:list-help:list-owner:list-unsubscribe:
	 list-subscribe:list-post; bh=QVlX/6+pD1bXXy1hwdr6LYayl+Mt3BXRIZLyvuWMwYk=;
	b=HbHReIdsWiSJdvIoAAB2ssva+OoecvOzTU58Bu2gtbNgTYLlITgQeUMlgoYmbkZ3gkieU7
	OMSYOAjs5uPY680aKEqqgTfq/2PzCymhZitzlVrX5HrYfTqw8To+q2CuDE75bYg2wWMAtC
	MM/5izNVWEn1oLr74nvPS006PSL4XdBMdzJPknGt6W6RyGCqip+pukPbEVzNEqHak29uEH
	/pWF8HOYp35OX5zRfOmPRIVyPYl9dICfXs59k4n4J3auB1Qax0jUNsk3kSBMiSpQ+KURsX
	KEPlAe0+aJeCqylolDzUOJYgdxQQLMoBWvL09o/PfoqgFVlCp89o3UZ3l0I+Vw==
X-Original-To: freebsd-fs@mlmmj.nyi.freebsd.org
Authentication-Results: mx1.freebsd.org;
	dkim=pass header.d=gmail.com header.s=20251104 header.b=akb8P0vB;
	arc=pass ("google.com:s=arc-20260327:i=1");
	spf=pass (mx1.freebsd.org: domain of zbeeble@gmail.com designates 2607:f8b0:4864:20::132e as permitted sender) smtp.mailfrom=zbeeble@gmail.com;
	dmarc=pass (policy=none) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1792471421; x=1793076221; darn=freebsd.org;
        h=content-type:cc:to:subject:message-id:date:from:in-reply-to
         :references:mime-version:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=QVlX/6+pD1bXXy1hwdr6LYayl+Mt3BXRIZLyvuWMwYk=;
        b=akb8P0vBG3tdUd6l2mkU15mUn6YBeT1E+g4txFejH0+V77nxN7jT6wQRULgy1AN4c2
         GcoL4/aiWR5VHo6x0IQgqqVbKFRqMVl8QNn0TAKwQb07+CXSaK5kwTENcO4Vga3pQBkc
         o1PB+CjXdTrSdOOZ/WsYNYXybV22r0jApwOi0p4G0L3tUUM0ZZjlNU+Hwzvmy3TT8Bf+
         Id+AaI7dKcSsKNx7JLaQVXVA87XxXvXUlyuDIRooCtreX0XvO1XjjJyqkAJkh/9TKe/p
         eMmZgiJymBXmMa+5uP8+fcbuYf04ItHFa17OTwWP7KWo8wNQ6saAkEAYyu7WlV69udLI
         9/Jg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1792471421; x=1793076221;
        h=content-type:cc:to:subject:message-id:date:from:in-reply-to
         :references:mime-version:x-gm-gg:x-gm-message-state:from:to:cc
         :subject:date:message-id:reply-to:content-type;
        bh=QVlX/6+pD1bXXy1hwdr6LYayl+Mt3BXRIZLyvuWMwYk=;
        b=AUJq4ztXkls6G3NXb2U3304jO69mdYHa/DBgQORWLDMH9wCuOgOYfxIcCChePD1nHE
         JbI0qXl04EtCeFjPqNB6AA4R/DzgO0PLJ0/ETbadqsfX8vk3nakLXcc5chkVDSN7nf3h
         ua0rlo7guGKvPoVlW29M5NqKsWallkKA4MEINlBnO+Hyj+WWoGZ1YSmbKODanFuS6ZGy
         siXqrnm2FOAYK0ANXc79Ew9MAWgONRiAMOrKMlUAojHu3Jx/wES7rH8NtGbABtwjPjO6
         5VSfh9VuPQOH5W18alji9FMxk3Iub+JxhRtUAZLLSzLi0AA3GL71ClpRIbBTmOOarbF5
         sSmw==
X-Gm-Message-State: AFq9FYJoJBcuMnl+G5ezPGs3L7Ux0ALrMMTTtapNnenmZyVze1XGjYmZ
	qZfkW8/yIJ84gA7djLs85nZtxiwaFsNHUwfQ2u64mJwOoXC99lEYJrw4He2cfVfynFRB3Vy9IAO
	DdD5fjmWljQiSCwuK7Z9SBkRHafay4Q==
X-Gm-Gg: AYBFou13p6Al2su8XQ4o7hyrkGckTlDWpc0mEKkKw6ijk1CZQNgNxmO01YeT6vFKlt0
	zznDFJ488sDERk4Sn/dg09YeWXfgTGVVzfnZvXK3p0L8MkIcty4ZGoikP0dbFG9DZ84f3JGyIWL
	7u22LpvmU8cf25RG5/QE5c59iEHw6l4djI97U6ec7pub3tw8k4073TeoY5+S6QCJMcGmPMwgFZG
	wAqU+LLiI+SafZ51j5gR6Dcm20gde43VlN2iFUdj0NcruIbIcCEzNX8MWejP3xzO1gkQ7VjVmSt
	2CJ/glyv3FYVhWmXsepwb/znL+lKcIVhmHqiRfFKkDpsoZCNxVOU+GQW
Precedence: list
In-Reply-To: <2465EDDD-2138-4E90-8058-33D9E1A1B326@iitbombay.org>
X-Gm-Features: AclHuK9zvte0zoavTFNNSap-ovMIo7DMUAWsu-iQMFz4aTKR_1hvix0zqWeutYY
X-Spamd-Bar: --
X-Spamd-Result: default: False [-2.00 / 15.00];
	ARC_ALLOW(-1.00)[google.com:s=arc-20260327:i=1];
	DMARC_POLICY_ALLOW(-0.50)[gmail.com,none];
	R_DKIM_ALLOW(-0.20)[gmail.com:s=20251104];
	R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4864::/56];
	MIME_GOOD(-0.10)[multipart/alternative,text/plain];
	RCVD_COUNT_ONE(0.00)[1];
	ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US];
	FREEMAIL_FROM(0.00)[gmail.com];
	MISSING_XM_UA(0.00)[];
	FREEMAIL_ENVFROM(0.00)[gmail.com];
	DWL_DNSWL_NONE(0.00)[gmail.com:dkim];
	MIME_TRACE(0.00)[0:+,1:+,2:~];
	RCVD_TLS_LAST(0.00)[];
	RCPT_COUNT_TWO(0.00)[2];
	TO_MATCH_ENVRCPT_SOME(0.00)[];
	FROM_EQ_ENVFROM(0.00)[];
	FROM_HAS_DN(0.00)[];
	RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::132e:from];
	PREVIOUSLY_DELIVERED(0.00)[freebsd-fs@freebsd.org];
	MID_RHS_MATCH_FROMTLD(0.00)[];
	TO_DN_ALL(0.00)[];
	MLMMJ_DEST(0.00)[freebsd-fs@freebsd.org];
	DKIM_TRACE(0.00)[gmail.com:+]
X-Rspamd-Queue-Id: 4j80DM6W63z54hZ
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes