NetBSD-Bugs archive

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

bin/56422: zgrep -l sometimes hangs



>Number:         56422
>Category:       bin
>Synopsis:       zgrep -l sometimes hangs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 29 14:05:00 +0000 2021
>Originator:     Andreas Gustafsson
>Release:        NetBSD 9.2 and -current
>Organization:
  
>Environment:
System: NetBSD
Architecture: x86_64
Machine: amd64
>Description:

When I run "zgrep -l *.gz" on a large collection of compressed log
files, it sometimes hangs.

>How-To-Repeat:

This is difficult to reproduce exactly as originally experienced
because a given log file may reliably trigger the problem on one
machine but not on another.

However, I have come up with an analog test case that reliably
reproduces the problem on multiple machines under NetBSD 9.2 and
-current.  It uses synthetic data generated using lptest(1) in place of
the log files, and a pipeline of "gunzip | head -1" in place of "zgrep -l":

  for n in $(seq 100000); do lptest 10 $n | gzip | gunzip | head -1; done >log

Run the above command in one terminal and observe the size of the log
file in another terminal by repeatedly running

  wc -l log

The expected behavior is that the log file slowly grows to a size of
100000 lines and the shell command that generated it exits.  The
observed behavior is that at some point before that, the log file
stops growing, and the shell command generating it has hung with the
"head" process in the "DE" state:

# ps -glaxwd
UID   PID PPID   CPU PRI NI   VSZ    RSS WCHAN   STAT TTY      TIME COMMAND
[...]
  0  7920 1604 28360  79  0 24012   3732 wait    I    tty00 0:13.81 |   |-- -sh
  0 20716 7920     0   0  0 22232   1724 -       DE   tty00 0:00.00 |   | |-- (head)
  0 22105 7920 28360  79  0 24584   1768 pipe_wr I    tty00 0:00.00 |   | `-- gunzip

>Fix:



Home | Main Index | Thread Index | Old Index