Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Sep 2012 23:01:54 GMT
From:      Garrett Cooper <yanegomi@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/171427: [sh] Hitting ^Z doesn't suspend jobs like expected
Message-ID:  <201209072301.q87N1sJi018747@red.freebsd.org>
Resent-Message-ID: <201209072310.q87NA2f2076833@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         171427
>Category:       bin
>Synopsis:       [sh] Hitting ^Z doesn't suspend jobs like expected
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 07 23:10:01 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Cooper
>Release:        7.4-RELEASE/9.1-RELEASE
>Organization:
EMC Isilon
>Environment:
FreeBSD  7.4-STABLE FreeBSD 7.4-STABLE #0: Fri Aug 24 15:41:28 UTC 2012     root@bf049.west.isilon.com:/usr/obj/mnt/freebsd/stable/7/sys/ISI-GENERIC  amd64

FreeBSD wf048.west.isilon.com 9.1-RC1 FreeBSD 9.1-RC1 #0: Fri Aug 17 02:18:40 PDT 2012     root@wf048.west.isilon.com:/usr/obj/mnt/freebsd/releng/9.1/sys/ISI-GENERIC  amd64
>Description:
Running some netperf tests in a while loop like so under /bin/sh, I'm running into
cases where the while loop continues to loop, even after I mash on ^C (which I would expect to kill netperf eventually -- works on 9.1-RC1, but not 7.4-STABLE) or ^Z (I would expect job control to stop spawning jobs, but it doesn't in either version):

bf049# exec sh


wf048# exec sh
$ while : ; do netperf -cCjt TCP_STREAM -H 10.7.187.52 -l 10 -- -D; done

..

^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^ZTCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
Recv   Send    Send                          Utilization       Service Demand
Socket Socket  Message  Elapsed              Send     Recv     Send    Recv
Size   Size    Size     Time     Throughput  local    remote   local   remote
bytes  bytes   bytes    secs.    10^6bits/s  % C      % C      us/KB   us/KB

 65536  32768  32768    10.01       810.28   8.05     7.52     3.254   6.080  
TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.56 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo

Bash on the other hand does stop the code snippet:

$ while : ; do netperf -cCjt TCP_STREAM -H 10.7.187.52 -l 10 -- -D; done
TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.7.187.52 () port 0 AF_INET : nodelay : histogram : interval : dirty data : demo
^Z
[1]+  Stopped                 netperf -cCjt TCP_STREAM -H 10.7.187.52 -l 10 -- -D

The expected behavior isn't documented in sh(1) and in the opengroup sh(1) manpage.
>How-To-Repeat:
exec sh
while : ; do netperf -cCjt TCP_STREAM -H $IP -l 10 -- -D; done

You could probably replace the second command (to netperf) with something that blocks.
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209072301.q87N1sJi018747>