unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18772: 24.3; Emacs deadlocks on subprocess write when read is pending
@ 2014-10-19  7:06 Haitao Zhang
  2014-10-19 17:55 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Haitao Zhang @ 2014-10-19  7:06 UTC (permalink / raw)
  To: 18772

[-- Attachment #1: Type: text/plain, Size: 7809 bytes --]

I have reliably experienced UI freezes under the following conditions:
1) A large read from a subprocess is in progress (2+MBs, around 2
seconds on Windows with w32-pipe-read-delay set to 0).
2) A mid-sized write is sent to the subprocess, from a not very large source
code buffer but large enough to block the write. The subprocess will not
read from its side until it finishes the transfer started in 1.

Killing the subprocess unfreezes Emacs. The error message indicates that
Emacs blocked on the write, complaing about the process being dead while
writing. The process buffer, normally mopped up by the process filter,
is filled with text midway through the transfer, indicating that the process
filter has stopped getting called. Finally locking out the offending
blocking write while the read is still in progress has ensured that the
deadlocks no longer happen. Success of the workaround gives me
confidence that this is an Emacs bug or feature.

Reading through the Emacs source files, it appears that when user calls
process-send-* in elisp eventually Emacs calls send_process in
process.c. If the send blocks it calls wait_reading_process_output,
which in turn should read pending output. Apparently in my case this is
not happening and a deadlock occured instead. My use case has large and
large enough transfers going both ways which may be different from
typical use patterns. Also on Windows reading from the pipe is slow even
when the w32-pipe-read-delay is set to 0 which gives more opportunities
for the deadlock to happen. I note again that this happens reliably
instead of intermittently once the conditions listed above are met.

I hope this bug report will help you in improving Emacs.

Haitao Zhang


If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
c:/alt/emacs/emacs-24.3/etc/DEBUG.

In GNU Emacs 24.3.1 (i386-mingw-nt6.2.9200)
 of 2013-03-17 on MARVIN
Windowing system distributor `Microsoft Corp.', version 6.2.9200
Configured using:
 `configure --with-gcc (4.7) --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include
 -ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include
 -ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2'

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1252
  default enable-multibyte-characters: t

Major mode: C++/l

Minor modes in effect:
  irony-mode: t
  global-company-mode: t
  company-mode: t
  autopair-global-mode: t
  autopair-mode: t
  delete-selection-mode: t
  cua-mode: t
  recentf-mode: t
  global-auto-revert-mode: t
  tooltip-mode: t
  mouse-wheel-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
  abbrev-mode: t

Recent input:
<wheel-up> <down-mouse-1> <mouse-1> <return> <tab>
i f SPC ( c a c A-H-s-  h e <tab> p <tab> . A-H-s-
f <backspace> F <backspace> <backspace> . A-H-s-  <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> g e t E <return> SPC =
= SPC " z i p <menu-bar> <buffer> C-a <menu-bar> <buffer>
C-a <up> <up> <up> <up> <up> <up> <up> C-a C-k C-k
<up> <up> <up> <up> C-v <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> C-k C-k <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<down> <down> C-y <up> <tab> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<backspace> ! <right> <right> <right> <right> <right>
<right> <right> <right> <right> <left> <return> <tab>
<down> <down> C-a C-k C-k <up> <up> C-y <up> <up> <up>
<up> <return> <down> <down> <down> <right> <right>
<right> <right> <down> <down> <down> <down> <down>
<left> <left> <left> <left> <left> <left> <right> <right>
<left> <right> C-k C-k C-k C-k C-k C-k C-k C-k C-k
C-k C-k C-k C-k <up> <up> <up> <up> <up> <up> <down>
<down> <up> <up> <up> <down> C-y <up> <up> <up> <up>
<up> <up> <right> <right> <right> <right> <right> <right>
<right> <left> E d g a A-H-s-  <down> <down> <return>
( u r i <right> SPC & & SPC <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <menu-bar> <help-menu> <emacs-manual-bug>
<help-echo> <down-mouse-1> <mouse-2> <wheel-down> <double-wheel-down>
<wheel-down> <double-wheel-down> q <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<menu-bar> <help-menu> <send-emacs-bug-report>

Recent messages:
Mark set [3 times]
Auto-saving...done
Mark set
Sending file request Sat Oct 18 21:05:59 2014
Received first 4038 Sat Oct 18 21:05:59 2014
EOT received 2240641 Sat Oct 18 21:06:01 2014
Sending file request Sat Oct 18 21:06:10 2014
Received first 4038 Sat Oct 18 21:06:10 2014
EOT received 2240785 Sat Oct 18 21:06:13 2014
Auto-saving...done

Features:
(shadow sort gnus-util mail-extr emacsbug message 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
mail-prsvr mail-utils yasnippet misearch multi-isearch lisp-mnt cl-macs
gv cc-langs cl cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs company-files company-oddmuse
company-keywords company-etags etags company-gtags company-dabbrev-code
company-dabbrev company-capf company-cmake company-ropemacs
company-xcode company-clang company-semantic company-eclim
company-template company-css company-nxml company-bbdb company-elisp
help-mode company-irony irony-completion irony-snippet irony-cdb irony
find-func company edmacro kmacro ediprolog python rx comint ring
ansi-color autopair advice help-fns advice-preload paren cl-lib delsel
cua-base recentf tree-widget wid-edit autorevert solarized-dark-theme
solarized dash autopair-autoloads cmake-mode-autoloads
company-irony-autoloads company-autoloads flycheck-autoloads info
easymenu irony-autoloads js2-mode-autoloads pkg-info-autoloads
epl-autoloads finder-inf request-deferred-autoloads request-autoloads
deferred-autoloads solarized-theme-autoloads dash-autoloads
yasnippet-autoloads package time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 ls-lisp w32-common-fns disp-table w32-win
w32-vars tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
w32 multi-tty emacs)

[-- Attachment #2: Type: text/html, Size: 9828 bytes --]

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

end of thread, other threads:[~2014-10-20  2:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-19  7:06 bug#18772: 24.3; Emacs deadlocks on subprocess write when read is pending Haitao Zhang
2014-10-19 17:55 ` Eli Zaretskii
2014-10-19 21:59   ` Haitao Zhang
2014-10-20  2:40     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).