bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Memory allocation problem with latest gawk - new testcase


From: Dmitry V. Levin
Subject: Re: Memory allocation problem with latest gawk - new testcase
Date: Thu, 3 Apr 2003 17:11:40 +0400

Greetings!

On Thu, Apr 03, 2003 at 03:06:39PM +0300, Aharon Robbins wrote:
> > Problem #1: gawk behaviour depends on kernel version.
> >
> > In attachment you can find testcase. It's demonstrates bug on 2.2.x kernels.
> > Diff between strace output on 2.2.x and 2.4.x kernels also included.
> 
> I'm very sorry, but I'm not responsible for kernel bugs.  If it works
> correctly under 2.4.x, then use a 2.4 kernel. That's what's current anyway.

We are talking about gawk-3.1.2 bug, not about kernel bugs.

If new version of userspace program changes behaviour on kernel, it
usually demonstrates bug in that program, not in the kernel.

Or maybe you mean that linux kernel 2.2.x is officially unsupported by
gawk >= 3.1.2?

You maybe you just want to get the patch? :)

> > > Problem #2: memory leak (works both on 2.2.x and 2.4.x kernels)
> > > 
> > > $(ulimit -Sv 16384 && time gawk '/.*/ {;}' /dev/zero)
> > > gawk: cmd. line:2: fatal: grow_iop_buffer: iop->buf: can't allocate 
> > > 16777218 bytes of memory (Cannot allocate memory)
> > > 0.03user 0.00system 0:00.12elapsed 24%CPU (0avgtext+0avgdata 
> > > 0maxresident)k
> > > 0inputs+0outputs (186major+75minor)pagefaults 0swaps
> >
> > Note:
> > this testcase works as expected (endless loop) with gawk 3.1.1.
> 
> I'm afraid you're not understanding what's going on.  The basic idea is that
> gawk reads characters until it finds the record separator, by default a 
> newline.
> Since /dev/zero has no newlines in it, it will keep growing the buffer until
> it runs out of memory.  You have limited the amount of memory to 16 meg or so,
> so of course it eventually runs out of memory, and reports a fatal error.
> 
> I would state that the 3.1.1 behavior is a bug, fixed in 3.1.2.

Hereby you declare that gawk 3.1.2 cannot be used safely for the tasks
where gawk 3.1.1 works?

Here is one more testcase:

$ (gawk --version |head -1; ulimit -Sv 16384 && (yes y |tr -d '\n' |head -c 
65536; echo n) |gawk '/y*n/ {print "found"}'; echo rc=$?)
GNU Awk 3.1.1
found
rc=0

$ (gawk --version |head -1; ulimit -Sv 16384 && (yes y |tr -d '\n' |head -c 
65536; echo n) |gawk '/y*n/ {print "found"}'; echo rc=$?)
GNU Awk 3.1.2
gawk: cmd. line:2: fatal: grow_iop_buffer: iop->buf: can't allocate
16777218 bytes of memory (Cannot allocate memory)
rc=2


--
ldv

Attachment: pgp0NMlOA5m2C.pgp
Description: PGP signature


reply via email to

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