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+d__5.MoveNext() Microsoft.Build.Locator!Microsoft.Build.Locator.DotNetSdkLocationHelper+d__4.MoveNext() Microsoft.Build.Locator!Microsoft.Build.Locator.MSBuildLocator+d__20.MoveNext() System.Linq!System.Linq.Enumerable.TryGetFirst(class System.Collections.Generic.IEnumerable`1,bool&) System.Linq!System.Linq.Enumerable.FirstOrDefault(class System.Collections.Generic.IEnumerable`1) 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] | 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 >> 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 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.