unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Colascione <dancol@dancol.org>
To: Michael Albinus <michael.albinus@gmx.de>,
	Paul Eggert <eggert@cs.ucla.edu>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: some accept-process-output races fixed; Tramp FIXMEs
Date: Mon, 21 Jan 2019 18:02:22 -0500	[thread overview]
Message-ID: <6701efcd-d45d-3a85-acb0-c38593bb5744@dancol.org> (raw)
In-Reply-To: <875zujlkhv.fsf@gmx.de>

On 1/20/19 4:57 AM, Michael Albinus wrote:
> Paul Eggert <eggert@cs.ucla.edu> writes:
> 
> Hi Paul,
> 
>> The Tramp code still contains several loops like this:
>>
>>    (while (or (accept-process-output p 0.1)
>>               (process-live-p p)))
>>
>> that suffer from race conditions. Consider the following sequence of events:
>>
>> * accept-process-output times out after 0.1 seconds, and returns nil.
>> * P generates some data and then exits.
>> * process-live-p returns nil.
>>
>> In this case the loop will exit and lose data. This bug is caused by
>> the " 0.1" in that loop. I don’t know why the " 0.1" is there, but if
>> the " 0.1" has to be there then I suppose one way to fix the bug would
>> be to enhance accept-process-output so that its caller can distinguish
>> a timeout from a connection-closed.
> 
> IIRC, the timeout is used because accept-process-output could be blocked
> otherwise. Tramp has often the need to check whether there is still
> output from the process, and the timeout is the only way I know that
> accept-process-output returns in finite time.
> 
> At least this was the case 15+ years ago, and also supporting XEmacs. If
> we could guarantee that (accept-process-output p) returns when either
> output has arrived and or the process has finished, I could change the
> code. This promise must be kept for all Emacs versions since 24, and for
> all platforms, including w32.

In general, timeout arguments that mean "I really want to just poll" 
should be exactly zero.



  reply	other threads:[~2019-01-21 23:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15 18:33 some accept-process-output races fixed; Tramp FIXMEs Paul Eggert
2019-01-16  8:32 ` Michael Albinus
2019-01-16  8:38   ` Paul Eggert
2019-01-16  8:49     ` Michael Albinus
2019-01-16 13:03   ` Michael Albinus
2019-01-16 13:25 ` Stefan Monnier
2019-01-16 18:39   ` Paul Eggert
2019-01-16 19:07     ` Stefan Monnier
2019-01-17  0:15       ` Paul Eggert
2019-01-20  9:57     ` Michael Albinus
2019-01-21 23:02       ` Daniel Colascione [this message]
2019-01-22 16:54         ` Eli Zaretskii
2019-01-22  7:09       ` Paul Eggert
2019-01-22 16:56       ` Eli Zaretskii
2019-01-22 18:58         ` Michael Albinus
2019-01-22 22:06       ` Stefan Monnier
2019-01-22 22:45         ` Michael Albinus
2019-01-23 16:18           ` Eli Zaretskii
2019-01-23 18:35             ` Michael Albinus
2019-01-23 22:19               ` Daniel Pittman
2019-01-23 16:47           ` Stefan Monnier
2019-01-23 17:36             ` Paul Eggert
2019-01-28 15:37               ` Michael Albinus

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=6701efcd-d45d-3a85-acb0-c38593bb5744@dancol.org \
    --to=dancol@dancol.org \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=michael.albinus@gmx.de \
    --cc=monnier@iro.umontreal.ca \
    /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).