[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

odd behavior of while loop, leading to crash

From: Jim Wright
Subject: odd behavior of while loop, leading to crash
Date: Sun, 15 Sep 2002 08:29:12 -0700 (PDT)

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu'
-D_FILE_OFFSET_BITS=64  -I.  -I. -I./include -I./lib -I/usr/include -O2
-march=i386 -mcpu=i686
uname output: Linux foo.penguincomputing.com 2.4.9-31SGI_XFS_1.0.2 #1 Fri Mar 1
15:39:42 CET 2002 i686 unknown
Machine Type: i386-redhat-linux-gnu

Bash Version: 2.05
Patch Level: 8
Release Status: release

        [Detailed description of the problem, suggestion, or complaint.]

I would expect that on an otherwise idle machine the date command can be
run roughly the same number of times per second over long periods of time.
But across several different machines with different versions of bash2
installed I see a trend over a few minutes where fewer and fewer instances
are run.  This generally settles down to a low constant rate of execution.
Often, the process dies with

    malloc: array.c:78: assertion botched
    free: called with already freed block argument
    last command: while [ 1 ] ; do date ; done | uniq -c
    Stopping myself...

Running 'top' shows a bash process that keeps eating memory.  It's not
the login bash process, it's a child process that's started for this
pipeline, so when you kill it, the memory gets released back.

On an old system with bash 1.14.7(1), I observe the behavior I expect.

        [Describe the sequence of events that causes the problem
        to occur.]

Run this command

    while [ 1 ] ; do date ; done | uniq -c

reply via email to

[Prev in Thread] Current Thread [Next in Thread]