emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 2c79a8f 2/2: Use posix_spawn if possible.


From: Saulius Menkevicius
Subject: Re: master 2c79a8f 2/2: Use posix_spawn if possible.
Date: Mon, 31 Jan 2022 22:48:33 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

I did a bit more investigation (and still don't have a reproduction vehicle) but it seems the problem has to do with signals (SIGCHLD in particular) rather than stdio redirection.

Stack trace in the child process shows it has launched a subprocess which has since exited but the child did not receive (?) SIGCHLD and appears to be blocked.

Dotnet stack trace is

[bob@fedora emacs]$ dotnet stack report -p 53193
Thread (0xCFC9):
  [Native Frames]
  System.Private.CoreLib!System.Threading.WaitHandle.WaitOneNoCheck(int32)
  System.Private.CoreLib!System.Threading.WaitHandle.WaitOne(int32)
  System.Diagnostics.Process!System.Diagnostics.ProcessWaitState.WaitForExit(int32)
  System.Diagnostics.Process!System.Diagnostics.Process.WaitForExitCore(int32)
  Microsoft.Build.Locator!Microsoft.Build.Locator.DotNetSdkLocationHelper+<GetDotNetBasePaths>d__5.MoveNext()
  Microsoft.Build.Locator!Microsoft.Build.Locator.DotNetSdkLocationHelper+<GetInstances>d__4.MoveNext()
  Microsoft.Build.Locator!Microsoft.Build.Locator.MSBuildLocator+<GetInstances>d__20.MoveNext()
  System.Linq!System.Linq.Enumerable.TryGetFirst(class System.Collections.Generic.IEnumerable`1<!!0>,bool&)
  System.Linq!System.Linq.Enumerable.FirstOrDefault(class System.Collections.Generic.IEnumerable`1<!!0>)
  Microsoft.Build.Locator!Microsoft.Build.Locator.MSBuildLocator.RegisterDefaults()
  CSharpLanguageServer!CSharpLanguageServer.Program.entry(class System.String[])

Where "ps axl" shows there is a zombie process waiting to be collected but is not.

0  1000   53193   53129  20   0 3437284 59416 -     Ssl  ?          0:00 /home/bob/src/csharp-language-server/src/CSharpLanguageServer/bin/Debug/net6.0/CSharpLanguageServer
0  1000   53203   53193  20   0      0     0 -      Z    ?          0:00 [dotnet] <defunct>


Related emacs src/callproc.cs has code that has this comment:

/* Stop blocking SIGCHLD in the child.  */

But I really don't know what should I do to attempt to fix this/find the cause.

-Saulius

Am 29.01.22 um 10:26 schrieb Eli Zaretskii:
From: Matt Armstrong <matt@rfc20.org>
Cc: p.stephani2@gmail.com, alan@idiocy.org, mituharu@math.s.chiba-u.ac.jp,
 emacs-devel@gnu.org
Date: Fri, 28 Jan 2022 09:12:22 -0800

Eli Zaretskii <eliz@gnu.org> writes:

To actually figure that out I would need to build a minimal test fixture 
for this bug/issue and submit to dotnet/runtime repo on github for them 
to check and/or fix it.
I think there's no way around this.  We need at least to understand
what part of posix_spawn code interferes with pipe-based I/O used by
these LSP servers, and why.
I don't find an emacs bug filed for this issue.  Saulius, it would be
good to file one.

This issue tickled a memory I had of Python moving away from posix_spawn
due to various portability issues: https://bugs.python.org/issue35823.
The issues they ran into and solved may inform this investigation.
Thanks.

I see nothing there about C#, nor even about problems with stdio
redirection in subprocesses.  There's some reference to closing file
descriptors above 2, but AFAIU the problems in this bug report are
related to descriptors that aren't above 2.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]