From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel Newsgroups: gmane.emacs.bugs Subject: bug#22344: 25.0.50 (and 24.5.1, 24.4); Sending 4097 bytes to a subprocess hangs Emacs on Windows 8 and 10 Date: Mon, 11 Jan 2016 00:42:01 -0500 Message-ID: <569340A9.3010904@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="LhClVkI83IijskXhoW51VuJ5VsSTNrbpB" X-Trace: ger.gmane.org 1452491139 25577 80.91.229.3 (11 Jan 2016 05:45:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 Jan 2016 05:45:39 +0000 (UTC) To: 22344@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 11 06:45:28 2016 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 1aIVID-0004xt-Rt for geb-bug-gnu-emacs@m.gmane.org; Mon, 11 Jan 2016 06:45:26 +0100 Original-Received: from localhost ([::1]:51749 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIVID-0007zS-8R for geb-bug-gnu-emacs@m.gmane.org; Mon, 11 Jan 2016 00:45:25 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIVFx-0003gU-FR for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2016 00:43:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIVFu-0002Fp-6l for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2016 00:43:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:57707) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIVFt-0002FY-QK for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2016 00:43:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aIVFt-0003Qu-L3 for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2016 00:43:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Jan 2016 05:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 22344 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.145249094713155 (code B ref -1); Mon, 11 Jan 2016 05:43:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Jan 2016 05:42:27 +0000 Original-Received: from localhost ([127.0.0.1]:45927 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aIVFK-0003Q7-Kg for submit@debbugs.gnu.org; Mon, 11 Jan 2016 00:42:26 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47871) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aIVFI-0003Ps-Ia for submit@debbugs.gnu.org; Mon, 11 Jan 2016 00:42:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIVFB-0001t9-Vs for submit@debbugs.gnu.org; Mon, 11 Jan 2016 00:42:19 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:34018) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIVFB-0001t5-T2 for submit@debbugs.gnu.org; Mon, 11 Jan 2016 00:42:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIVFA-0002Et-29 for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2016 00:42:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIVF5-0001rd-8S for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2016 00:42:14 -0500 Original-Received: from mout.kundenserver.de ([212.227.17.24]:55357) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIVF4-0001rZ-V9 for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2016 00:42:11 -0500 Original-Received: from [18.189.87.242] ([18.189.87.242]) by mrelayeu.kundenserver.de (mreue102) with ESMTPSA (Nemesis) id 0LlWdD-1ZjizO2Xrz-00bGkd for ; Mon, 11 Jan 2016 06:42:09 +0100 X-Enigmail-Draft-Status: N1110 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 X-Provags-ID: V03:K0:FBZZaYbIoT4h9AVg/vomRbHuVDXJojNXPOeD3dqyt5j3TG8OE71 kQfEKW4qkubO1qYFnlO/XZGxF+KHCFkzCQvQd8tqKC0ZppQusSpuwQKrcV08Np826d/LuDm YC7LlHymIpTRB2N3ItElrEO79tiW9tsY6XSq/5qK4m1Ka4NSDUbywEbmMdWULExYPXPQg67 4tONvsZVYxAvta812ZkEg== X-UI-Out-Filterresults: notjunk:1;V01:K0:IJnyB9LitBI=:jr73BKjbgMKrNreh2JYRO8 GO0fPlYqFxy2/BqYeEDpQerd8naUmRWnl6iaMA+DK8xevGcTpWH9DgVaRK+Zdrwi08azegChI Zenex8Jjh4KeEWqNKbqoxqubyGeQaXq0NzQom/iEXIV1N9AHSmoEmhO9AF4qyBJXzte63Klvb 0u4sm9rhwlLO3FtnbeYlm2i3uRRVZPeCkU+/pycu271m6izdjy4dG5U3RwJViBY7SOR3egevP dzLUOMi4z4TK6WOuxnsFC5QMPfArAcKZcUbii2dRVPe2XpVqWPnULzHCA9mnsgbP+fq946uZX aYoLdK1O7LSw0zY4E9FzhmJZ1K5oDLdbCaxsFRxensJ9gwD1D2yATUy03zOu/e0qlIPp2w16W H0O2ilvXTAJlJ4cN+fmxwSB11jL9g5dICYjE9nlZe0yDg7MSLB6MJuNXnw6boYNbmRRteaq7n JgY5whXbs+5UM5hree1HeRl8CiK16dAGktztSFIOKx8zVx9E5+wU5NlZuT2eskA8tkWQmr6LW DQnyLipd9IUlwqRMmK8d988rwgwft32JYH4mdhgJ0pzCnViEsjJeEiW37wnhoOScFV1nd3kzf xagYaZoV4qNty5KGAtylFHRCEAj9lUFa196dh2pAiGC17wwG3BQvdb/Q6UZ9O9O9j38b/YfZA aZoZqLRTQsTyLV6lU2AgChF9GQiEY4l+qpIaL5USSkh0IKy/hMQPDgzjVNadhxP/Dry8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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:111486 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --LhClVkI83IijskXhoW51VuJ5VsSTNrbpB Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi all, On Windows, sending more that 4096 bytes at once to a subprocess will cau= se Emacs to hang (freeze) indefinitely. Killing the subprocess by externa= l means restores functionality. This happens in Emacs 25, 24.5.1, and 24.= 4 on Windows 8 and 10; I did not try in earlier versions. Here is how to reproduce the issue: 1. Create a loop.cmd file in C:\. Put the following in it: :loop goto loop 2. Run the following snippet in emacs -Q: (process-send-string (start-process "bug" nil "c:/loop.cmd") (make-string 4097 ?a)) 3. Emacs hangs. Kill cmd.exe from the task manager to make it responsive = again. At this point Emacs will display the following: Debugger entered--Lisp error: (file-error "Writing to process" "Invali= d argument" #) process-send-string(# "(...)") eval-region(192 277 t #[257 "\300\242b\210\301\207" [(277) (process-= send-string (start-process "bug" nil "c:/loop.cmd") (make-string 4097 97)= )] 2 "\n\n(fn IGNORE)"]) ; Reading at buffer position 277 elisp--eval-defun() eval-defun(nil) funcall-interactively(eval-defun nil) call-interactively(eval-defun nil nil) command-execute(eval-defun) Note that the following snippet, on the other hand, runs without issues: (process-send-string (start-process "bug" nil "c:/loop.cmd") (make-string 4096 ?a)) I have read sections 7.1 and 7.2 of https://www.gnu.org/software/emacs/ma= nual/html_mono/efaq-w32.html , but I do not believe that the bug is cover= ed by these sections. Indeed, sending the same input in smaller batches w= orks fine. That is, sending 4097 bytes in batches of 50 bytes works fine:= Emacs does not hang, and the subprocess properly receives the input. Here is some context: we've had many users of Flycheck (an alternative to= Flymake) on Windows complaining that Flycheck caused Emacs to hang; this= happened since we transitioned from passing file names to linters to fee= ding them source code directly on their stdin. It turns out that this hap= pens when the files in question are more than 4096 characters long. The p= roblem was confirmed with jshint, eshint, and phpcs. I do not know if tha= t means that other linters work fine, or if we didn't get reports from ot= her users. Investigating the bug led me to the minified test case above. As I mentionned before, sending input in smaller batches works fine. In t= he case of Flycheck, this means changing this: (process-send-region (point-min) (point-max)) to this: (goto-char (point-mint)) (while (not (eobp)) (let ((from (point))) (forward-char (min 50 (- (point-max) (point)))) (process-send-region process from (point)))) fixes the issue entirely. I do not use Windows often, but I'll be happy to provide more information= , if I can help. I did not compile my own Emacs; I used the one provided = at https://sourceforge.net/projects/emacsbinw64/ . The original bug repor= t about Flycheck, which did not identify process-send-string or process-s= end-region as the culprit, is here: https://github.com/flycheck/flycheck/= issues/794 . I have included debug output below. Thanks, Cl=C3=A9ment. In GNU Emacs 25.0.50.1 (x86_64-w64-mingw32) of 2015-11-10 Repository revision: 9145e79dc2042fb477959ddda59c3e2ff5fa3914 Windowing system distributor 'Microsoft Corp.', version 6.3.9600 Configured using: 'configure --prefix=3D/z/emacs --host=3Dx86_64-w64-mingw32 --target=3Dx86_64-w64-mingw32 --build=3Dx86_64-w64-mingw32 --with-wide-i= nt --with-jpeg --with-xpm --with-png --with-tiff --with-rsvg --with-xml2 --with-gnutls --with-sound=3Dyes --with-file-notification=3Dyes --without-dbus --without-imagemagick 'CFLAGS=3D-O3 -fomit-frame-pointer -g0 -pipe' 'LDFLAGS=3D-static-libgcc -static-libstdc++ -static -s -Wl,-s'' Configured features: XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS Important settings: value of $LANG: ENU locale-coding-system: cp1252 Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message dired format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils help-mode easymenu cl-loaddefs pcase cl-lib debug time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp disp-table w32-win w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote w32notify w32 multi-tty make-network-process emacs) Memory information: ((conses 16 84225 4487) (symbols 56 19038 0) (miscs 48 64 168) (strings 32 14204 4737) (string-bytes 1 410641) (vectors 16 10727) (vector-slots 8 405995 4577) (floats 8 130 34) (intervals 56 274 32) (buffers 976 12)) --LhClVkI83IijskXhoW51VuJ5VsSTNrbpB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJWk0CwAAoJEPqg+cTm90wjPQAP/jYn1I16NT9OZbUqvIx+rc8L BymP2i7MR9Ckueyn1YQ7biMRwz3bx9mo38IsCPlzRWxrSJW2Q+zupvmqRotjuFRF JjS6K3awXNV9vaXLG8lwPDTs95xTYxhAVVIEhPpiDfpHdDUP4hh26Hxl2gLdvn3s SJgHw+8leoW9lck828g3Wr1Aa1IiKoRxXQSpl66SGcFk9R733vlLxiWccB7Pni1U Bzv9K6+o9FQSpgmu+MfzBULuTQsSFwOyr7ioM0OZvL1mSrKKRiQl6E1ibrO/m9B3 JWbOEkelhoHiGhQNJyR8Sj8BcQb+OM6YjytQvqrCj2CCUeuRGwek9Y+f9YNdaCvN Nr+lzEB004QiUJfsRzjTFAM/NFkOWyxORr73IXB6Ksw40M6sjDtEO36ZLmzTxg9w 9BKyuPho+Ufby24Yy0iBOEPLs+KFPIvoNN+HH7abG60IZzchhhBaHRKi0Km1Sojw wFSV8/M1pjLG7ed5mehrT0SirNo9pdsrzc95bbGFjXa3R20eLVZwAQUtUEnnz7xX pOFN5tEiqifRYjhdprf5UpTNf61Lzjoa4R++lybcbIStHUmsSALgrKP3DzD6i+pn qu1cI5R+MrHWqWkrNHrGaC0oTDBK6IMAFBWNxhJHS9oZKyePBCU29qEVN5uQy+1Y wC1iNO9n3i4t2EPk3moy =FZug -----END PGP SIGNATURE----- --LhClVkI83IijskXhoW51VuJ5VsSTNrbpB--