From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jorgen Schaefer Newsgroups: gmane.emacs.bugs Subject: bug#18396: 24.3.1; On windows, process-send-string can freeze Emacs Date: Wed, 03 Sep 2014 18:58:11 +0200 Message-ID: <87k35kod3w.fsf@loki.jorgenschaefer.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1409763629 12050 80.91.229.3 (3 Sep 2014 17:00:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Sep 2014 17:00:29 +0000 (UTC) To: 18396@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 03 19:00:23 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 1XPDuw-0000d2-N5 for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Sep 2014 19:00:22 +0200 Original-Received: from localhost ([::1]:46686 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPDuw-00089M-Ao for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Sep 2014 13:00:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPDuo-00087M-Ch for bug-gnu-emacs@gnu.org; Wed, 03 Sep 2014 13:00:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPDue-0002wr-T7 for bug-gnu-emacs@gnu.org; Wed, 03 Sep 2014 13:00:14 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38212) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPDue-0002wV-QT for bug-gnu-emacs@gnu.org; Wed, 03 Sep 2014 13:00:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XPDue-0008GR-AE for bug-gnu-emacs@gnu.org; Wed, 03 Sep 2014 13:00:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jorgen Schaefer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Sep 2014 17:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18396 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.140976355031666 (code B ref -1); Wed, 03 Sep 2014 17:00:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Sep 2014 16:59:10 +0000 Original-Received: from localhost ([127.0.0.1]:58009 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XPDtl-0008Ef-TU for submit@debbugs.gnu.org; Wed, 03 Sep 2014 12:59:10 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51224) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XPDtj-0008EQ-Pp for submit@debbugs.gnu.org; Wed, 03 Sep 2014 12:59:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPDtZ-0002Qr-0C for submit@debbugs.gnu.org; Wed, 03 Sep 2014 12:59:02 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:55246) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPDtY-0002Qn-TH for submit@debbugs.gnu.org; Wed, 03 Sep 2014 12:58:56 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPDtT-0007pA-Vt for bug-gnu-emacs@gnu.org; Wed, 03 Sep 2014 12:58:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPDtL-0002Oa-HV for bug-gnu-emacs@gnu.org; Wed, 03 Sep 2014 12:58:51 -0400 Original-Received: from loki.jorgenschaefer.de ([87.230.15.51]:34201) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPDtL-0002OC-B2 for bug-gnu-emacs@gnu.org; Wed, 03 Sep 2014 12:58:43 -0400 Original-Received: by loki.jorgenschaefer.de (Postfix, from userid 1000) id 6957A2011D5; Wed, 3 Sep 2014 18:58:11 +0200 (CEST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). 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:92993 Archived-At: Hi! A user's bug report[1] on my project Elpy has revealed an apparent bug in Emacs. [1] https://github.com/jorgenschaefer/elpy/issues/212#issuecomment-54015294 Elpy starts a Python process using `start-process' with `process-connection-type' set to nil, `default-directory' set to "/", and an unchanged coding system. It then proceeds to talk with the subprocess using a JSON-RPC-based protocol. After some interactions, this freezes an Emacs under Windows. C-g does not lead to any reaction. Killing the subprocess unfreezes Emacs. The freeze happens more reliably the larger the data sent is. I asked the user to change the function that does the process communication to the following: (defun elpy-rpc--call (method-name params success error) (let ((promise (elpy-promise success error))) (with-current-buffer (elpy-rpc--get-rpc-buffer) (setq elpy-rpc--call-id (1+ elpy-rpc--call-id)) (elpy-rpc--register-callback elpy-rpc--call-id promise) (let ((proc (get-buffer-process (current-buffer))) (text (json-encode `((id . ,elpy-rpc--call-id) (method . ,method-name) (params . ,params))))) (message "Sending %s bytes ..." (length text)) (process-send-string proc text) (process-send-string proc "\n") (message "Sending %s bytes ... done." (length text)))) promise)) This lead to the following output in *Messages*: Sending 978 bytes ... done. Sending 958 bytes ... done. Sending 959 bytes ... done. Sending 960 bytes ... done. Sending 961 bytes ... done. Sending 962 bytes ... done. Sending 958 bytes ... At this point, Emacs froze. Apparently, it did so in the middle of one of the two `process-send-string' calls. Killing the subprocess caused the following output: eldoc error: (file-error writing to process invalid argument elpy-rpc [project:~/ python:pythonw]) Elpy indeed is called from eldoc, and "elpy-rpc [project:~/ python:pythonw]" is the process name. I'm a bit at a loss now as to how to continue debugging this. I do not use Windows myself. I'm sure the user is willing to do some debugging and reproduction cases there, but I wouldn't even know how to start or what to ask them to do (Windows doesn't have strace, does it?). Jorgen