From: Paul Eggert <eggert@cs.ucla.edu>
To: Dmitry Gutov <dgutov@yandex.ru>, 19860-done@debbugs.gnu.org
Subject: bug#19860: 25.0.50; One url-retrieve-synchronously call running concurrently with another can freeze it
Date: Sat, 25 Apr 2015 16:19:52 -0700 [thread overview]
Message-ID: <553C2118.4080106@cs.ucla.edu> (raw)
In-Reply-To: <553A3489.6080504@yandex.ru>
[-- Attachment #1: Type: text/plain, Size: 277 bytes --]
Dmitry Gutov wrote:
> 'git bisect' points to 12dc5429352223f7ba8314d2e16177036a762733.
>
> Paul, could you look into this?
Thanks for doing all that legwork. It let me reproduce the problem and come up
with a simple fix that works for me. I installed the attached patch.
[-- Attachment #2: 0001-Don-t-freeze-with-unreadable-processes.patch --]
[-- Type: text/x-patch, Size: 2351 bytes --]
From 9ca712e2689f1875d7facd229f2cb1916719cf49 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat, 25 Apr 2015 16:16:58 -0700
Subject: [PATCH] Don't freeze with unreadable processes
Don't freeze if an exiting process can't be read from. (Bug#19860).
This fixes a bug I introduced in
2014-07-08T07:24:07Z@eggert@cs.ucla.edu
"* process.c: Add sanity checks for file descriptors."
Dmitry Gutov did most of the legwork in finding the problem.
* src/process.c (wait_reading_process_output):
Treat non-running processes that can't be read from
the same as other non-running processes.
---
src/process.c | 40 ++++++++++++++++++++++------------------
1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/src/process.c b/src/process.c
index c745507..3e04cb7 100644
--- a/src/process.c
+++ b/src/process.c
@@ -4785,37 +4785,41 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
if (wait_proc && wait_proc->raw_status_new)
update_status (wait_proc);
if (wait_proc
- && wait_proc->infd >= 0
&& ! EQ (wait_proc->status, Qrun)
&& ! EQ (wait_proc->status, Qconnect))
{
bool read_some_bytes = false;
clear_waiting_for_input ();
- XSETPROCESS (proc, wait_proc);
- /* Read data from the process, until we exhaust it. */
- while (true)
+ /* If data can be read from the process, do so until exhausted. */
+ if (wait_proc->infd >= 0)
{
- int nread = read_process_output (proc, wait_proc->infd);
- if (nread < 0)
+ XSETPROCESS (proc, wait_proc);
+
+ while (true)
{
- if (errno == EIO || errno == EAGAIN)
- break;
+ int nread = read_process_output (proc, wait_proc->infd);
+ if (nread < 0)
+ {
+ if (errno == EIO || errno == EAGAIN)
+ break;
#ifdef EWOULDBLOCK
- if (errno == EWOULDBLOCK)
- break;
+ if (errno == EWOULDBLOCK)
+ break;
#endif
- }
- else
- {
- if (got_some_input < nread)
- got_some_input = nread;
- if (nread == 0)
- break;
- read_some_bytes = true;
+ }
+ else
+ {
+ if (got_some_input < nread)
+ got_some_input = nread;
+ if (nread == 0)
+ break;
+ read_some_bytes = true;
+ }
}
}
+
if (read_some_bytes && do_display)
redisplay_preserve_echo_area (10);
--
2.1.4
next prev parent reply other threads:[~2015-04-25 23:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-14 0:09 bug#19860: 25.0.50; One url-retrieve-synchronously call running concurrently with another can freeze it Dmitry Gutov
[not found] ` <handler.19860.B.142387261510331.ack@debbugs.gnu.org>
2015-02-15 22:19 ` bug#19860: Acknowledgement (25.0.50; One url-retrieve-synchronously call running concurrently with another can freeze it) Dmitry Gutov
2015-02-16 1:00 ` Dmitry Gutov
2015-02-17 19:20 ` bug#19860: 25.0.50; One url-retrieve-synchronously call running concurrently with another can freeze it Glenn Morris
2015-02-17 23:24 ` Dmitry Gutov
2015-04-24 12:18 ` Dmitry Gutov
2015-04-25 23:19 ` Paul Eggert [this message]
2015-04-26 4:24 ` Dmitry Gutov
2015-04-26 4:30 ` Dmitry Gutov
2015-04-26 5:11 ` Paul Eggert
2015-04-26 15:28 ` Dmitry Gutov
2015-04-26 21:47 ` Paul Eggert
2015-04-26 15:01 ` Eli Zaretskii
2015-04-26 15:23 ` bug#19729: " Dmitry Gutov
2015-12-25 18:34 ` Lars Ingebrigtsen
2015-12-25 20:08 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=553C2118.4080106@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=19860-done@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.