dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Vitaly Zuevsky" <vitaly.zuevsky@gmail.com>
To: 'Harald van Dijk' <harald@gigawatt.nl>,
	'Andrej Shadura' <andrew@shadura.me>,
	953421@bugs.debian.org, dash@vger.kernel.org
Cc: 'Debian Bug Tracking System' <submit@bugs.debian.org>
Subject: RE: Bug#953421: dash: Resident Set Size growth is unbound (memory leak) on an infinite shell loop
Date: Thu, 2 Apr 2020 14:18:28 +0100	[thread overview]
Message-ID: <004401d608f1$3349e670$99ddb350$@gmail.com> (raw)
In-Reply-To: a2efaae8-db1b-39ae-d7c2-8d119a4f14d4@gigawatt.nl

Hi Harald,

Thanks for comprehensive account of the job flow - all worked as expected now.

Interestingly, I originally assumed it was a bug due to observed discrepancy with bash...

On 29/03/2020 23:07, Jilles Tjoelker wrote:
> I agree that the change is incorrect, but I do not agree that this kind
> of script must leak memory. Per POSIX.1-2008 XCU 2.9.3.1 Asynchronous
> Lists, an implementation has additional ways to forget about jobs than
> just an appropriate completion of the wait utility: if another
> asynchronous job is started when $! was not referenced or if the number
> of known process IDs would exceed {CHILD_MAX} (which tends to be rather
> big, though).

I can see in Bash man pages:

CHILD_MAX
  Set the number of exited child status values for the shell to remember.  Bash will not allow this value to be decreased
  below a POSIX-mandated minimum, and there is a maximum value (currently 8192) that this may not  exceed.   The  minimum
  value is system-dependent.

Running above scripts under bash shell manifests growing RSS just initially, and with sleep .1 that growth will end after some 800 seconds as one could deduce from the man pages. That is, RSS growth is bound.

I understand dash philosophy could be focussed on the most minimalistic solution possible. Such solution would inherently be less forgiving in terms of mistakes. On the other hand, the mistake in question can be difficult to detect and leads all the way to OOM, negatively affecting user experience.

It is up to you and community where that balance should rest. And if you decide the change would be worthy of doing - I will be more than happy to contribute.

Cheers,
Vitaly 

      parent reply	other threads:[~2020-04-02 13:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <158376996556.31988.8584094104007124674.reportbug@ec2-34-240-101-198.eu-west-1.compute.amazonaws.com>
     [not found] ` <CACujMDPfs5mJs8CVaxqM6wkCRANYQ71wTUkvHiNvOg+MPSTECQ@mail.gmail.com>
2020-03-29 17:54   ` Bug#953421: dash: Resident Set Size growth is unbound (memory leak) on an infinite shell loop Vitaly Zuevsky
2020-03-29 19:06     ` Harald van Dijk
2020-03-29 22:07       ` Jilles Tjoelker
2020-03-29 23:07         ` Harald van Dijk
2020-03-31 19:07       ` Vitaly Zuevsky
2020-03-31 21:04         ` Harald van Dijk
2020-04-02 13:18       ` Vitaly Zuevsky [this message]

Reply instructions:

You may reply publicly 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

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

  git send-email \
    --in-reply-to='004401d608f1$3349e670$99ddb350$@gmail.com' \
    --to=vitaly.zuevsky@gmail.com \
    --cc=953421@bugs.debian.org \
    --cc=andrew@shadura.me \
    --cc=dash@vger.kernel.org \
    --cc=harald@gigawatt.nl \
    --cc=submit@bugs.debian.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).