[8982] in Athena Bugs
emacs/edsc spin
daemon@ATHENA.MIT.EDU (Calvin Clark)
Mon Feb 17 09:16:58 1992
Date: Mon, 17 Feb 92 09:16:21 -0500
From: Calvin Clark <ckclark@mit.edu>
To: bugs@Athena.MIT.EDU
Cc: bug-discuss@Athena.MIT.EDU, jefft@Athena.MIT.EDU, honor@Athena.MIT.EDU,
Reply-To: ckclark@mit.edu
(This message is in reply to transactions [8716], [8918], and [8922] in
bugs.)
I think that the edsc spin is not an emacs bug, but is intentionally (or
unintentionally) coded into discuss.el. Examine the following function,
which is run any time Emacs sends a command to edsc for it to execute:
(defun discuss-block-til-ready (verbose)
"Block, waiting until the previous operation for discuss finished.
If VERBOSE is non-nil, then print a message that we're waiting for the
discuss server while we spin-block."
(if discuss-in-progress
(progn
(while discuss-in-progress
(if verbose
(message "waiting for discuss..."))
(sit-for 1)
(accept-process-output))
(message ""))))
Considering this, I think that you will find that the emacs/edsc spin is
fantastically easy to reproduce by using the following script in place
of edsc:
#!/bin/sh
cat > /dev/null
In other words, if for some reason edsc does not return its full output
soon, the process filter will never set `discuss-in-progress' to `nil',
and emacs will stay spinning in this while loop, because that's what
it's being told to do. One way to solve this problem is to explicitly
put timeouts in edsc, so that it won't keep emacs waiting too long.
Another solution is to use the "timer" package to allow emacs to control
the edsc timeout itself.
(I am not exactly sure that this is the whole of the problem. I suspect
that there may be more to it than this. I have not proven that edsc is
in fact not producing output when this spin occurs, so it may still be
an emacs bug. However, the approach taken in `discuss-block-til-ready'
is clearly prone to such problems, and a robust method of timeout should
be implemented in any case. I took a quick glance at the edsc code, and
it doesn't look like there are any timeouts, but there may be some in
the discuss libraries.)
-Calvin