all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#18396: 24.3.1; On windows, process-send-string can freeze Emacs
@ 2014-09-03 16:58 Jorgen Schaefer
  2014-09-03 18:03 ` Eli Zaretskii
  2014-11-01 15:37 ` bug#18396: No further updates Jorgen Schaefer
  0 siblings, 2 replies; 8+ messages in thread
From: Jorgen Schaefer @ 2014-09-03 16:58 UTC (permalink / raw)
  To: 18396

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





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-11-01 15:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-03 16:58 bug#18396: 24.3.1; On windows, process-send-string can freeze Emacs Jorgen Schaefer
2014-09-03 18:03 ` Eli Zaretskii
2014-09-03 18:43   ` Jorgen Schaefer
2014-09-03 19:01     ` Eli Zaretskii
2014-09-03 19:28       ` Jorgen Schaefer
2014-09-04  2:51         ` Eli Zaretskii
2014-09-09 18:45           ` Eli Zaretskii
2014-11-01 15:37 ` bug#18396: No further updates Jorgen Schaefer

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.