From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#18420: 24.3; interaction with external process hangs emacs Date: Sun, 07 Sep 2014 18:38:49 +0300 Message-ID: <83fvg3cueu.fsf@gnu.org> References: <85y4tvn9ek.fsf@stephe-leake.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1410104370 7386 80.91.229.3 (7 Sep 2014 15:39:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 7 Sep 2014 15:39:30 +0000 (UTC) Cc: 18420@debbugs.gnu.org To: stephen_leake@stephe-leake.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 07 17:39:22 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XQeYj-00082c-Ev for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Sep 2014 17:39:21 +0200 Original-Received: from localhost ([::1]:38540 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQeYj-0002g5-3R for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Sep 2014 11:39:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQeYa-0002f6-Mq for bug-gnu-emacs@gnu.org; Sun, 07 Sep 2014 11:39:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XQeYU-0007fM-CJ for bug-gnu-emacs@gnu.org; Sun, 07 Sep 2014 11:39:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41374) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQeYU-0007Tt-7W for bug-gnu-emacs@gnu.org; Sun, 07 Sep 2014 11:39:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XQeYQ-0001QS-6u for bug-gnu-emacs@gnu.org; Sun, 07 Sep 2014 11:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Sep 2014 15:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18420 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18420-submit@debbugs.gnu.org id=B18420.14101043345468 (code B ref 18420); Sun, 07 Sep 2014 15:39:02 +0000 Original-Received: (at 18420) by debbugs.gnu.org; 7 Sep 2014 15:38:54 +0000 Original-Received: from localhost ([127.0.0.1]:32938 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XQeYH-0001Q7-VB for submit@debbugs.gnu.org; Sun, 07 Sep 2014 11:38:54 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:65258) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XQeYE-0001Pq-UV for 18420@debbugs.gnu.org; Sun, 07 Sep 2014 11:38:52 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0NBJ00500FFUXX00@a-mtaout22.012.net.il> for 18420@debbugs.gnu.org; Sun, 07 Sep 2014 18:38:44 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NBJ005KZFGJG660@a-mtaout22.012.net.il>; Sun, 07 Sep 2014 18:38:44 +0300 (IDT) In-reply-to: <85y4tvn9ek.fsf@stephe-leake.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:93103 Archived-At: > Date: Sun, 07 Sep 2014 03:04:51 -0500 > From: stephen_leake@stephe-leake.org > > ;; WORKAROUND: process-send-string is supposed to allow accepting > ;; process output while writing to process input, but apparently > ;; it doesn't, at least on windows via pipes. So break up > ;; buf-string, and call accept-process-output explicitly > (let ((bytes-per-cycle 2047) > (bytes-to-send (length buf-string)) > (first 0) > (last 0)) > (while (< last bytes-to-send) > (setq last (min bytes-to-send (+ first bytes-per-cycle))) > (message "%d" last) > (process-send-string process (substring buf-string first last)) > (setq first (1+ last)) > (accept-process-output process 0.1))) > (wisi-ada-parse-session-wait) > )) > > It hangs on one of the process-send-string calls in the WORKAROUND loop. Did you try replacing accept-process-output with sit-for? How about enlarging the 2nd argument to accept-process-output -- did you try that, and if so, did it have any effect? > The loop is replacing an earlier version that used a single > process-send-string to send the entire buffer string. I was hoping that > the explicit accept-process-out calls would allow C-g to work, but > apparently not. I cannot easily interpret this, too much info is missing. For starters, if the parser gets only part of its expected input (whose size you are apparently passing via command-line arguments), would it start parsing, or will it wait for the rest? If the latter, then the way you've broken the buffer string into chunks will not change anything, right? > The external process implements an LALR parser for Ada source; it > outputs the parse results back to Emacs. There is a lot of output, so > it can easily fill up the IO queue. Attaching to that process when > Emacs is hung shows it is blocked writing to stdout, in a normal part > of the code flow. Can you tell how much did it write to the pipe at that point? > Attaching the debugger I have to the Emacs process shows that it is > also blocked in WriteFile, called from emacs_write, but I can't see > any farther up the stack; the debugger says the stack is corrupt. I > don't have debugging symbols, so I can't tell where in Emacs write it > is. If you didn't have debugging symbols, GDB wouldn't be able to show you symbols like emacs_write and WriteFile. In any case, it sounds like your binary is optimized, in which case backtraces are not useful at best, and downright misleading at worst. > I'm working on building Emacs from the pre-release source, and > installing a compatible debugger. Be sure to build with CFLAGS='-O0 -g3'. What is your versions of GCC, Binutils, MinGW runtime, and w32 API headers, btw?