all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Saulius Menkevicius <sauliusmenkevicius@fastmail.com>
To: Robert Pluim <rpluim@gmail.com>
Cc: alan@idiocy.org, emacs-devel@gnu.org, p.stephani2@gmail.com,
	Matt Armstrong <matt@rfc20.org>, Eli Zaretskii <eliz@gnu.org>,
	mituharu@math.s.chiba-u.ac.jp
Subject: Re: master 2c79a8f 2/2: Use posix_spawn if possible.
Date: Tue, 1 Feb 2022 20:30:18 +0200	[thread overview]
Message-ID: <e75b674c-8db4-465e-be47-3b46e9916d23@fastmail.com> (raw)
In-Reply-To: <87pmo6c3h6.fsf@gmail.com>

Thanks Robert!

I applied your patch and that has actually has fixed the issue. So I 
suggest this patch be applied on master.

-Saulius

Am 01.02.22 um 11:59 schrieb Robert Pluim:
>>>>>> On Mon, 31 Jan 2022 22:48:33 +0200, Saulius Menkevicius <sauliusmenkevicius@fastmail.com> said:
>      Saulius> I did a bit more investigation (and still don't have a reproduction
>      Saulius> vehicle) but it seems the problem has to do with signals (SIGCHLD in
>      Saulius> particular) rather than stdio redirection.
>
>      Saulius> Stack trace in the child process shows it has launched a subprocess
>      Saulius> which has since exited but the child did not receive (?) SIGCHLD and
>      Saulius> appears to be blocked.
>
>      Saulius> Dotnet stack trace is
>
>      Saulius> |[bob@fedora emacs]$ dotnet stack report -p 53193 Thread (0xCFC9):
>      Saulius>  [Native Frames]
>      Saulius>  System.Private.CoreLib!System.Threading.WaitHandle.WaitOneNoCheck(int32)
>      Saulius>  System.Private.CoreLib!System.Threading.WaitHandle.WaitOne(int32)
>      Saulius>  System.Diagnostics.Process!System.Diagnostics.ProcessWaitState.WaitForExit(int32)
>      Saulius>  System.Diagnostics.Process!System.Diagnostics.Process.WaitForExitCore(int32)
>      Saulius>  Microsoft.Build.Locator!Microsoft.Build.Locator.DotNetSdkLocationHelper+<GetDotNetBasePaths>d__5.MoveNext()
>      Saulius>  Microsoft.Build.Locator!Microsoft.Build.Locator.DotNetSdkLocationHelper+<GetInstances>d__4.MoveNext()
>      Saulius>  Microsoft.Build.Locator!Microsoft.Build.Locator.MSBuildLocator+<GetInstances>d__20.MoveNext()
>      Saulius>  System.Linq!System.Linq.Enumerable.TryGetFirst(class
>      Saulius>  System.Collections.Generic.IEnumerable`1<!!0>,bool&)
>      Saulius>  System.Linq!System.Linq.Enumerable.FirstOrDefault(class
>      Saulius>  System.Collections.Generic.IEnumerable`1<!!0>)
>      Saulius>  Microsoft.Build.Locator!Microsoft.Build.Locator.MSBuildLocator.RegisterDefaults()
>      Saulius>  CSharpLanguageServer!CSharpLanguageServer.Program.entry(class
>      Saulius>  System.String[]) |
>
>      Saulius> Where "ps axl" shows there is a zombie process waiting to be collected
>      Saulius> but is not.
>
>      Saulius> |0 1000 53193 53129 20 0 3437284 59416 - Ssl ? 0:00
>      Saulius>  /home/bob/src/csharp-language-server/src/CSharpLanguageServer/bin/Debug/net6.0/CSharpLanguageServer
>      Saulius>  0 1000 53203 53193 20 0 0 0 - Z ? 0:00 [dotnet] <defunct> |
>
>
>      Saulius> Related emacs src/callproc.cs has code that has this comment:
>
>      Saulius> /* Stop blocking SIGCHLD in the child.  */
>
>      Saulius> But I really don't know what should I do to attempt to fix this/find
>      Saulius> the cause.
>
> Despite the comment, that code doesnʼt actually unblock SIGCHLD, it
> just sets the child mask to be the same as the parent, and SIGCHLD and
> SIGINT are blocked in the parent at this point.
>
> Try the following:
>
> diff --git a/src/callproc.c b/src/callproc.c
> index 4d3b0bb8e0..2b4e8977a3 100644
> --- a/src/callproc.c
> +++ b/src/callproc.c
> @@ -1378,6 +1378,12 @@ emacs_posix_spawn_init_attributes (posix_spawnattr_t *attributes)
>     /* Stop blocking SIGCHLD in the child.  */
>     sigset_t oldset;
>     error = pthread_sigmask (SIG_SETMASK, NULL, &oldset);
> +  if (error != 0)
> +    goto out;
> +  error = sigdelset (&oldset, SIGCHLD);
> +  if (error != 0)
> +    goto out;
> +  error = sigdelset (&oldset, SIGINT);
>     if (error != 0)
>       goto out;
>     error = posix_spawnattr_setsigmask (attributes, &oldset);



  reply	other threads:[~2022-02-01 18:30 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-25  6:48 master 2c79a8f 2/2: Use posix_spawn if possible Saulius Menkevicius
2022-01-25  8:41 ` Eli Zaretskii
2022-01-25  8:58   ` Saulius Menkevicius
2022-01-25 11:46     ` Jostein Kjønigsen
2022-01-25 11:55       ` Po Lu
2022-01-25 12:22     ` Eli Zaretskii
2022-01-25 12:25       ` Saulius Menkevicius
2022-01-25 13:47         ` Eli Zaretskii
2022-01-28 17:12           ` Matt Armstrong
2022-01-29  8:03             ` Saulius Menkevičius
2022-01-29  8:26             ` Eli Zaretskii
2022-01-31 20:48               ` Saulius Menkevicius
2022-02-01  9:59                 ` Robert Pluim
2022-02-01 18:30                   ` Saulius Menkevicius [this message]
2022-02-01 19:23                     ` Robert Pluim
2022-02-01 19:52                       ` Eli Zaretskii
2022-02-02  8:30                         ` Robert Pluim
2022-02-02  8:54                           ` Saulius Menkevičius
2022-02-07 21:12                             ` Saulius Menkevicius
2022-02-08  8:27                               ` Robert Pluim
2022-02-08 12:12                               ` Eli Zaretskii
2022-02-08 12:18                                 ` Saulius Menkevicius
2022-02-08 14:59                                   ` Robert Pluim
2022-02-08 21:09                                     ` Saulius Menkevicius
2022-02-09  8:48                                       ` Robert Pluim
2022-02-12  8:44                                         ` Saulius Menkevicius
2022-02-12  8:59                                           ` Eli Zaretskii
2022-02-12  9:42                                             ` Saulius Menkevicius
2022-03-04  8:38                   ` [PATCH] posix_spawn blocks SIGCHLD in spawned processes (was: Re: master 2c79a8f 2/2: Use posix_spawn if possible.) Jürgen Hötzel
2022-03-04 10:07                     ` [PATCH] posix_spawn blocks SIGCHLD in spawned processes Robert Pluim
2022-03-04 15:41                       ` Jürgen Hötzel
2022-03-04 16:08                         ` Robert Pluim
2022-04-17 18:22                         ` Philipp Stephani
2022-04-19 14:36                           ` Robert Pluim
2022-04-19 14:48                             ` Philipp Stephani
2022-04-19 16:07                             ` Eli Zaretskii
2022-04-19 17:32                               ` Robert Pluim
2022-04-04 14:13                       ` Robert Pluim
2022-01-25 13:15 ` master 2c79a8f 2/2: Use posix_spawn if possible Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2021-11-08 11:00 Aaron Jensen
2021-11-08 11:03 ` Aaron Jensen
2021-11-08 19:37 ` Alan Third
2021-11-09 14:46 ` Philipp
2021-11-09 15:57   ` Aaron Jensen
2021-11-09 17:05     ` Eli Zaretskii
2021-11-09 18:12       ` Aaron Jensen
2021-11-12 11:48         ` Philipp
2021-11-12 13:42           ` Aaron Jensen
2021-11-12 22:05             ` Alan Third
2021-11-13 14:08               ` Aaron Jensen
2021-11-13 16:03                 ` Philipp
2021-11-13 16:17                   ` Aaron Jensen
2021-11-15 15:01           ` Dmitry Gutov
2020-12-25 13:16 Eli Zaretskii
2020-12-26 11:26 ` Philipp Stephani
2020-12-26 12:08   ` Eli Zaretskii
2020-12-26 12:16     ` Eli Zaretskii
2020-12-29 16:43       ` Philipp Stephani
2020-12-31 16:24         ` Philipp Stephani
2020-12-31 16:39           ` Eli Zaretskii
2020-12-31 17:36             ` Philipp Stephani
2020-12-31 17:47               ` Eli Zaretskii
2020-12-31 20:24                 ` Philipp Stephani
2020-12-31 20:36                   ` Eli Zaretskii
2021-01-01  7:59                     ` martin rudalics
2021-01-01  8:04                       ` Eli Zaretskii
2021-01-01 23:38           ` Andy Moreton
2021-01-01 23:56             ` Alan Third
2021-01-02  1:12               ` Andy Moreton
2021-01-02  6:53                 ` Eli Zaretskii
2021-01-02  8:56                   ` Andreas Schwab
2021-10-29  9:46                     ` YAMAMOTO Mitsuharu
2021-10-30 18:30                       ` Alan Third
2021-11-02 19:58                         ` Alan Third
2021-11-02 20:15                           ` Eli Zaretskii
2021-11-02 20:36                             ` Alan Third
2021-11-03  3:24                               ` Eli Zaretskii
2021-11-10 12:42                                 ` Philipp Stephani
2021-11-10 14:10                                   ` Eli Zaretskii
2021-11-11 17:52                                     ` Philipp
2021-11-11 18:00                                       ` Eli Zaretskii
2021-11-11 21:04                                         ` Philipp
2020-12-29 16:29     ` Philipp Stephani
2020-12-29 18:15       ` Eli Zaretskii
2020-12-29 21:36         ` Philipp Stephani
2020-12-30  3:33           ` Eli Zaretskii
2020-12-31 16:10             ` Philipp Stephani
2020-12-31 18:33               ` Eli Zaretskii
2020-12-31 17:50       ` Philipp Stephani
2020-12-31 18:34         ` Eli Zaretskii
2020-12-31 20:14           ` Philipp Stephani

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=e75b674c-8db4-465e-be47-3b46e9916d23@fastmail.com \
    --to=sauliusmenkevicius@fastmail.com \
    --cc=alan@idiocy.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=matt@rfc20.org \
    --cc=mituharu@math.s.chiba-u.ac.jp \
    --cc=p.stephani2@gmail.com \
    --cc=rpluim@gmail.com \
    /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.