zsh-workers
 help / color / mirror / code / Atom feed
* A05 Test Hang
@ 2015-01-25 21:28 Vin Shelton
  2015-01-25 23:51 ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Vin Shelton @ 2015-01-25 21:28 UTC (permalink / raw)
  To: Zsh Hackers' List

With latest sources, I'm getting a hang up on A05:

 ZTST_VERBOSE=3 make TESTNUM=A05 check
cd Test ; make check
make[1]: Entering directory `/raid-3tb/opt/build/zsh-2015-01-25/Test'
if test -n "gcc"; then \
 cd .. && DESTDIR= \
 make MODDIR=`pwd`/Test/Modules install.modules > /dev/null; \
fi
if ZTST_testlist="`for f in /opt/src/zsh-2015-01-25/Test/A05*.ztst; \
           do echo $f; done`" \
ZTST_srcdir="/opt/src/zsh-2015-01-25/Test" \
ZTST_exe=../Src/zsh \
../Src/zsh +Z -f /opt/src/zsh-2015-01-25/Test/runtests.zsh; then \
stat=0; \
else \
stat=1; \
fi; \
sleep 1; \
rm -rf Modules .zcompdump; \
exit $stat
/opt/src/zsh-2015-01-25/Test/A05execution.ztst: starting.
This test takes 5 seconds to fail...

^C (intr) does not interrupt; I have to ^Z (suspend) and kill the job.

  - Vin


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A05 Test Hang
  2015-01-25 21:28 A05 Test Hang Vin Shelton
@ 2015-01-25 23:51 ` Bart Schaefer
  2015-01-26  0:01   ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2015-01-25 23:51 UTC (permalink / raw)
  To: Zsh Hackers' List

On Jan 25,  4:28pm, Vin Shelton wrote:
}
} With latest sources, I'm getting a hang up on A05:

Yes, this used to happen intermittently for me but with the latest
revision from git it now happens very consistently for me.

I have one shell stopped (job state "T", as if it got SIGTTOU or SIGTTIN)
here:

#1  0x00000000004a5225 in settyinfo (ti=0x7fff15c1ecc0) at utils.c:1626
#2  0x00000000004a654b in read_poll (fd=0, readchar=0x7fff15c1ef78, polltty=1, 
    microseconds=5000000) at utils.c:2332
#3  0x0000000000423efb in bin_read (name=0x2b528371bbb8 "read", 

And its child stopped here:

#0  0x00002b5282b0de70 in __close_nocancel ()
    at ../sysdeps/unix/syscall-template.S:82
#1  0x000000000042d92a in execpline2 (state=0x7fff15c1ff70, pcode=355, how=2, 
    input=0, output=0, last1=0) at exec.c:1748
#2  0x000000000042c87a in execpline (state=0x7fff15c1ff70, slcode=22530, 
    how=2, last1=0) at exec.c:1485
#3  0x000000000042bf38 in execlist (state=0x7fff15c1ff70, dont_change_job=1, 
    exiting=0) at exec.c:1268
#4  0x000000000042b95a in execode (p=0x2b528371b630, dont_change_job=1, 
    exiting=0, context=0x4b061f "eval") at exec.c:1074

If I back out the changes to polltty handling in read_poll() from 34365
(git commit 4688de16772beffc315bbf765475a2932cbd8628) it works again.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A05 Test Hang
  2015-01-25 23:51 ` Bart Schaefer
@ 2015-01-26  0:01   ` Bart Schaefer
  2015-01-26 10:09     ` Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2015-01-26  0:01 UTC (permalink / raw)
  To: Zsh Hackers' List

On Jan 25,  3:51pm, Bart Schaefer wrote:
}
} #1  0x00000000004a5225 in settyinfo (ti=0x7fff15c1ecc0) at utils.c:1626
} #2  0x00000000004a654b in read_poll (fd=0, readchar=0x7fff15c1ef78, polltty=1,
}     microseconds=5000000) at utils.c:2332
} #3  0x0000000000423efb in bin_read (name=0x2b528371bbb8 "read", 
} 
} If I back out the changes to polltty handling in read_poll() from 34365
} (git commit 4688de16772beffc315bbf765475a2932cbd8628) it works again.

This seems to do the trick (clearly a thinko to ignore the value of
polltty that is passed in as an argument):

diff --git a/Src/utils.c b/Src/utils.c
index 45f596a..d38babb 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2323,7 +2323,7 @@ read_poll(int fd, int *readchar, int polltty, zlong microseconds)
      * as plausible as it sounds, but it seems the right way to guess.
      *		pws 2000/06/26
      */
-    if (fd >= 0) {
+    if (polltty && fd >= 0) {
 	gettyinfo(&ti);
 	if ((polltty = ti.tio.c_cc[VMIN])) {
 	    ti.tio.c_cc[VMIN] = 0;


(Damn, that one test certainly seems to uncover a bunch of random issues.)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A05 Test Hang
  2015-01-26  0:01   ` Bart Schaefer
@ 2015-01-26 10:09     ` Peter Stephenson
  2015-01-26 16:35       ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2015-01-26 10:09 UTC (permalink / raw)
  To: Zsh Hackers' List

[-- Attachment #1: Type: text/plain, Size: 590 bytes --]

On 26 January 2015 at 00:01, Bart Schaefer <schaefer@brasslantern.com>
wrote:
> This seems to do the trick (clearly a thinko to ignore the value of
> polltty that is passed in as an argument):

Yes, the original test was for polltty; I simplified the code,
but simplified it the wrong way (polltty is now always false if
fd <= 0).  Thanks.

I'm still scratching my head over how it hung permanently,
but it must be something to do with using terminal input mode
when we shouldn't be.  So I suppose that's not particularly
suspicious beyond the bug,but I can't quite convince myself...

pws

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A05 Test Hang
  2015-01-26 10:09     ` Peter Stephenson
@ 2015-01-26 16:35       ` Bart Schaefer
  2015-01-26 16:40         ` Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2015-01-26 16:35 UTC (permalink / raw)
  To: Zsh Hackers' List

On Jan 26, 10:09am, Peter Stephenson wrote:
}
} I'm still scratching my head over how it hung permanently,

When polltty() is true, we call gettyinfo() and settyinfo() even if
the file descriptor has nothing to do with a tty.  The settyinfo()
triggers a SIGTTOU which stops the whole process group.

} but it must be something to do with using terminal input mode
} when we shouldn't be.  So I suppose that's not particularly
} suspicious beyond the bug,but I can't quite convince myself...

Comments in read_poll() seem to indicate that polltty is only needed
as some kind of workaround for Cygwin.  It could probably be combined
with an isatty() test, or possibly even replaced by one.

(Indentation was 5 spaces instead of 4 for those two lines, emacs
fixed it for me.)

diff --git a/Src/utils.c b/Src/utils.c
index d38babb..47d9944 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2300,8 +2300,8 @@ read_poll(int fd, int *readchar, int polltty, zlong microseconds)
     struct ttyinfo ti;
 #endif
 
-     if (fd < 0)
-	 polltty = 0;		/* no tty to poll */
+    if (fd < 0 || (polltty && !isatty(fd)))
+	polltty = 0;		/* no tty to poll */
 
 #if defined(HAS_TIO) && !defined(__CYGWIN__)
     /*


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A05 Test Hang
  2015-01-26 16:35       ` Bart Schaefer
@ 2015-01-26 16:40         ` Peter Stephenson
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Stephenson @ 2015-01-26 16:40 UTC (permalink / raw)
  To: Zsh Hackers' List

On Mon, 26 Jan 2015 08:35:25 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> Comments in read_poll() seem to indicate that polltty is only needed
> as some kind of workaround for Cygwin.

It's the reverse: it *doesn't* work on Cygwin,  It was found to be
needed on Solaris ages ago and apparently hasn't broken anything
anywhere else since.

pws


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-01-26 16:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-25 21:28 A05 Test Hang Vin Shelton
2015-01-25 23:51 ` Bart Schaefer
2015-01-26  0:01   ` Bart Schaefer
2015-01-26 10:09     ` Peter Stephenson
2015-01-26 16:35       ` Bart Schaefer
2015-01-26 16:40         ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).