Article View: gnu.emacs.bug
Article #98445network stream processes
From: Bjorn Victor
Date: Mon, 10 Jun 1991 09:04
Date: Mon, 10 Jun 1991 09:04
61 lines
3192 bytes
3192 bytes
In GNU Emacs 18.57.11 of Tue Mar 26 1991 on mizar (berkeley-unix)
(SunOS 4.0.3)
There is a bug somewhere in the network stream process handling which
appeared in 18.57, but which didn't exist in 18.55. It seems like
Emacs goes bonkers when the network connection is closed from the other
end.
The problem is not so big when Emacs is used on a fast machine, either
not using X11 or using a fast X11 server. However, when used with a
*slow* X11 server (such as mine, a TI Explorer), it practically hangs
the server. This could also be the bug that causes idle GNUS clients
to eat CPU.
A small program that shows the problem follows below.
* Do M-x telnet-bug, and give a machine name (e.g. your local machine).
* Do nothing, and wait for the telnet daemon to close the idle connection.
* Try "trace -p", gdb or whatever you like to study the process after
the network connection is closed. On my machine it will repeatedly
call select() and read() as fast as it can.
Please, fix this!
-- Bjorn Victor Bjorn.Victor@DoCS.UU.SE
Dept. of Computer Systems tel: +46 18183169; fax: +46 18550225
Uppsala University, Sweden "I'd rather hack a Lisp Machine!"
(defun telnet-bug (host)
(interactive "sHost: ")
(switch-to-buffer (get-buffer-create "Telnet bug"))
(setq mode-line-process '(": %s"))
(let ((process (open-network-stream "Bug" (current-buffer) host "telnet")))
(set-marker (process-mark process) (point-max))
(set-process-filter process 'telnet-bug-filter)))
(defun telnet-bug-filter (proc string)
(let ((match-data (match-data)))
(unwind-protect
(save-excursion
(set-buffer (process-buffer proc))
(goto-char (process-mark proc))
(let ((p (point)))
(insert-before-markers string)
(while (search-backward "\r\n" p t)
(delete-char 1))
(goto-char (process-mark proc))
;; Silly telnet option processing - Sun telnetd will hang without it
(while (search-backward "\377" p t)
(forward-char 1)
(let ((c (following-char)))
(forward-char 1)
(cond ((= c ?\373) ;WILL -> DO
(process-send-string proc (format "\377\375%c" (following-char))))
((= c ?\375) ;DO -> WON'T
(process-send-string proc (format "\377\374%c" (following-char))))
((= c ?\376) ;DON'T -> WON'T
(process-send-string proc (format "\377\374%c" (following-char)))))
(backward-char 2)))
(goto-char (process-mark proc))))
(store-match-data match-data))))
Technical Details
Message-ID:
<9106100904.AA00840@mizar.DoCS.UU.SE>Path:
arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!lll-winken!iggy.GW.Vitalink.COM!widener!ukma!usenet.ins.cwru.edu!tut.cis.ohio-state.edu!unreplyable!garbageShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,f9939cba60f257de,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1991-06-11 00:25:03 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!lll-winken!iggy.GW.Vitalink.COM!widener!ukma!usenet.ins.cwru.edu!tut.cis.ohio-state.edu!unreplyable!garbage From: Bjorn.Victor@docs.uu.se (Bjorn Victor) Newsgroups: gnu.emacs.bug Subject: network stream processes Message-ID: <9106100904.AA00840@mizar.DoCS.UU.SE> Date: 10 Jun 91 09:04:40 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 61 Approved: bug-gnu-emacs@prep.ai.mit.edu