GNU bug report logs - #63865
29.0.90; call-process while owning the X selection hangs other processes

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Sat, 3 Jun 2023 01:56:01 UTC

Severity: normal

Found in version 29.0.90

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: luangruo <at> yahoo.com, 63865 <at> debbugs.gnu.org
Subject: bug#63865: 29.0.90; call-process while owning the X selection hangs other processes
Date: Sat, 03 Jun 2023 17:24:11 +0300
> From: Spencer Baugh <sbaugh <at> janestreet.com>
> Cc: luangruo <at> yahoo.com,  63865 <at> debbugs.gnu.org
> Date: Sat, 03 Jun 2023 10:12:41 -0400
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Really?  "tons of places where it will run for prolonged periods of
> > time"? what is "prolonged period of time" for this purpose?  Aren't
> > you a tad exaggerating?
> 
> "prolonged period of time" is anything over a second.
> 
> I see tons of calls to call-process with potentially long-running
> programs.  "find", "gcc", "grep", "awk"... and depending on the user's
> system, *any* subprocess call can potentially run for a long time.

Please be specific.  For example, "grep" runs in an async subprocess;
we run it with call-process when we probe it for support of some
command-line option.  If you can show that these calls take "prolonged
period of time", please describe what you do and show the timing.

> But again, the point isn't just that they can potentially run for a long
> time.  It's that *the user's whole system can be unusable* while they
> run.  We are not just blocking Emacs, we are (sometimes) blocking
> *everything*.

AFAIU, the only "everything" that is blocked is an application that
happens to request an X selection at that precise time.  That should
be rare for short enough call-process runs, since the same user is
doing that.

> (defun my-call-process (program &optional destination &rest args)
>   (let ((process (make-process :name "call-process"
>                                :buffer destination
>                                :command (cons program args))))
>     (while (accept-process-output process))))
> 
> my-call-process is missing a few arguments that the real call-process
> has.  But if this is all I use, is there *any* reason to *not* use
> my-call-process on Linux?

You are free to do it if it suits your needs.  Emacs provides those
primitives to you.

But saying that this should replace call-process in each and every
case is a non-starter.

> There is at least one strong reason to use it: It won't hang other
> processes.

Yes, and gazillion complications, like handling the SIGCHLD signal,
pselect interface, etc.

> > Anyway, this kind of discussion doesn't belong in a bug report about X
> > selections.
> 
> But the entire point of this discussion, for me, is to fix the
> X-selection-related hangs which Emacs currently causes when in
> call-process.  i.e., this bug report.

It doesn't matter, because you insist on making the issue much more
general.




This bug report was last modified 1 year and 357 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.