From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: Eli Zaretskii <eliz@gnu.org>
Cc: michael.albinus@gmx.de, 33018@debbugs.gnu.org
Subject: bug#33018: 26.1.50; thread starvation with async processes and accept-process-output
Date: Wed, 17 Oct 2018 21:46:39 +0100 [thread overview]
Message-ID: <87zhvc2te8.fsf@tcd.ie> (raw)
In-Reply-To: <83woqgqvl2.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 17 Oct 2018 21:25:29 +0300")
Eli Zaretskii <eliz@gnu.org> writes:
>> Date: Wed, 17 Oct 2018 21:20:22 +0300
>> From: Eli Zaretskii <eliz@gnu.org>
>> Cc: michael.albinus@gmx.de, 33018@debbugs.gnu.org
>>
>> > From: "Basil L. Contovounesios" <contovob@tcd.ie>
>> > Cc: <michael.albinus@gmx.de>, <33018@debbugs.gnu.org>
>> > Date: Wed, 17 Oct 2018 19:05:59 +0100
>> >
>> > > Looks like the buffer of the pipe through which Emacs reads the stuff
>> > > is full, and wget waits for some space there?
>> >
>> > Would that imply that different threads/processes are (re)using the same
>> > buffer/pipe?
>>
>> Could be, but it's more likely that Emacs simply doesn't read the
>> output from wget.
>
> I think the relevant code should be instrumented to show which thread
> waits for what process(es).
Each thread launches a single wget process which it then waits for
before dying, and current-thread is always eq to that thread around
calls to accept-process-output. Or are you talking about some other
type of thread?
Either way, I'll report back when I've had a deeper look into what Emacs
is doing, unless someone beats me to it.
> Btw, are you sure this is not a bug in your program?
No, but the fact that it reliably works when Emacs is run with -batch,
and reliably hangs when run with -Q is at least somewhat intriguing.
> Michael caused your program to work twice by simple changes, AFAIU,
> no?
Michael avoided the hang by rewriting the create-join-...-create-join
sequence as create-create-...-join-join. But if the latter is done
twice from within the same master thread, the hang still occurs. As I
said:
> There's something about going through a complete create-join cycle more
> than once within a non-main-thread which is triggering this behaviour.
(Actually, I haven't checked whether the hang occurs when two
create-join cycles are completed within main-thread; I was just
specifically describing my sample program.)
In his second rewrite, Michael replaced wget with echo, which does not
suffer from any hangs. As I said:
> Indeed, there are many subprocess-within-a-thread examples which don't
> suffer from a hang, e.g. by using a different URL. I would like to get
> to the bottom of why network programs like wget/curl in particular
> eventually hang, though.
In other words, I don't (yet) see why my recipe shouldn't work, and I'm
curious to eventually get to the bottom of this.
I'm sorry I've been talking more than doing, but university and house
hunting will dominate my free time for the next few weeks.
Thanks,
--
Basil
next prev parent reply other threads:[~2018-10-17 20:46 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-11 14:57 bug#33018: 26.1.50; thread starvation with async processes and accept-process-output Basil L. Contovounesios
2018-10-12 8:07 ` Eli Zaretskii
2018-10-14 15:00 ` Basil L. Contovounesios
2018-10-14 15:17 ` Eli Zaretskii
2018-10-14 15:36 ` Basil L. Contovounesios
2018-10-12 12:02 ` Michael Albinus
2018-10-12 12:43 ` Eli Zaretskii
2018-10-12 12:49 ` Michael Albinus
2018-10-14 15:17 ` Basil L. Contovounesios
2018-10-15 8:02 ` Michael Albinus
2018-10-16 1:15 ` Basil L. Contovounesios
2018-10-16 13:54 ` Michael Albinus
2018-10-16 14:55 ` Basil L. Contovounesios
2018-10-16 14:58 ` Eli Zaretskii
2018-10-17 17:37 ` Basil L. Contovounesios
2018-10-17 17:56 ` Eli Zaretskii
2018-10-17 18:05 ` Basil L. Contovounesios
2018-10-17 18:20 ` Eli Zaretskii
2018-10-17 18:25 ` Eli Zaretskii
2018-10-17 20:46 ` Basil L. Contovounesios [this message]
2018-10-20 8:34 ` Eli Zaretskii
2018-10-17 20:02 ` Basil L. Contovounesios
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zhvc2te8.fsf@tcd.ie \
--to=contovob@tcd.ie \
--cc=33018@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=michael.albinus@gmx.de \
/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 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).