Skip to content

native commands doesn't return to prompt immediately sometimes #3941

Closed

Description

@vors

Steps to reproduce

I don't have repro, but it happens fairly consistent with me on macOS.
Maybe every 1 of 100 or so. Running it in the loop doesn't repro it.
I understand that's it not an actionable bug report, but I hitted it about 5 times in a last week and it's pretty frustrating, so I'd like to at least start the conversation about it. It could be not a powershell problem all together, but I tend to think that it's probably PS.

git branch 

Expected behavior

Print branches and return back to prompt

Actual behavior

Print branches and don't return to prompt for a very long time (perception like a hang, but eventually it returns to promp).

Environment data

> $PSVersionTable
Name                           Value                                                                                                                     
----                           -----                                                                                                                     
PSVersion                      6.0.0-beta                                                                                                                
PSEdition                      Core                                                                                                                      
BuildVersion                   3.0.0.0                                                                                                                   
CLRVersion                                                                                                                                               
GitCommitId                    v6.0.0-beta.1                                                                                                             
OS                             Darwin 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64            
Platform                       Unix                                                                                                                      
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                   
PSRemotingProtocolVersion      2.3                                                                                                                       
SerializationVersion           1.1.0.1                                                                                                                   
WSManStackVersion              3.0              

Activity

  1. iSazonov commented on Jun 6, 2017

    @iSazonov
    Collaborator

    Sometime I see any artifacts between VS Code and GitHub Desktop. So maybe the Issue is due to multiple git clients?

  2. vors commented on Jun 7, 2017

    @vors
    CollaboratorAuthor

    Happens with other native executables too, i.e. python test runner

  3. changed the title [-]`git branch` doesn't return to prompt immediately sometimes[/-] [+]native commands doesn't return to prompt immediately sometimes[/+] on Jun 8, 2017
  4. vors commented on Jun 8, 2017

    @vors
    CollaboratorAuthor

    Same with arc which is a tool for Phabricator.
    I'm very much convinced it's a PS problem.

  5. iSazonov commented on Jun 8, 2017

    @iSazonov
    Collaborator

    Maybe delayed sleep on waiting external process?

  6. vors commented on Jul 1, 2017

    @vors
    CollaboratorAuthor

    This happens consistently on all native executables but very rarely.
    I never can attach debugger quick enough to troubleshoot it.

    This is currently my biggest usability problem with powershell.

  7. iSazonov commented on Jul 1, 2017

    @iSazonov
    Collaborator

    Can we inject a trace hook?
    We can use WPT (WPR/WPA) on Windows. Have Unix an equivalent?

  8. vors commented on Jul 4, 2017

    @vors
    CollaboratorAuthor

    I captured some debug info attaching to the process and pausing it
    No symbols unfortunately

    image

    The PSReadLine one seems suspicious, cc Jason Shirk (@lzybkr)

    System.Private.CoreLib.ni.dll!System.Threading.WaitHandle.WaitAny(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext) (/Unknown Source:0)
    Microsoft.PowerShell.PSReadLine.dll!Microsoft.PowerShell.PSConsoleReadLine.ReadKeyThreadProc() (/Unknown Source:0)
    System.Private.CoreLib.ni.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) (/Unknown Source:0)
    [Native to Managed Transition] (/Unknown Source:0)
    
  9. lzybkr commented on Jul 4, 2017

    @lzybkr
    Contributor

    The PSReadline thread is probably not interesting, it's probably waiting for a signal to start reading keys.

  10. vors commented on Jul 4, 2017

    @vors
    CollaboratorAuthor

    Yes I realised it after reading some code. Maybe ApplicationInsight has something to do with it?

  11. iSazonov commented on Jul 4, 2017

    @iSazonov
    Collaborator

    Running it in the loop doesn't repro it.

    Maybe we need console IO (type emulation) to repo it?

  12. SteveL-MSFT commented on Jul 5, 2017

    @SteveL-MSFT
    Member

    sergei (@vors) the AppInsight code only runs once at startup

  13. vors commented on Jul 5, 2017

    @vors
    CollaboratorAuthor

    Steve Lee (@SteveL-MSFT) do you know where this appinsight call stack on Thread#1 coming from? I skimmed thru telemetry code and indeed it seems that it should be only relevant on a startup.

  14. SteveL-MSFT commented on Jul 5, 2017

    @SteveL-MSFT
    Member
  15. 17 remaining items

  16. SteveL-MSFT commented on Oct 2, 2017

    @SteveL-MSFT
    Member

    Just got a MacBook Pro and I've noticed this with just the git commands. Pretty annoying.

  17. vors commented on Oct 11, 2017

    @vors
    CollaboratorAuthor

    Also in another case I noticed that there are 2 threads that are waiting on the same ManualResetEvent. The second one is thru

  18. SteveL-MSFT commented on Oct 11, 2017

    @SteveL-MSFT
    Member

    As part of #4995, I'm changing it to reuse threads by default whereas previously it was creating a new thread everytime. It might help this situation.

  19. vors commented on Oct 18, 2017

    @vors
    CollaboratorAuthor

    One more observation about this situation is that once one powershell process hangs on a git command, others will too with very high probability

  20. vors commented on Nov 22, 2017

    @vors
    CollaboratorAuthor

    JFYI, still seeing it on 6.0.0-rc, so the thread reusing doesn't seems to help

  21. SteveL-MSFT commented on Dec 6, 2017

    @SteveL-MSFT
    Member

    Without a clear repro, moving to 6.1.0

  22. vors commented on Dec 24, 2017

    @vors
    CollaboratorAuthor

    FWIW it happens much more frequently after a system wake up. On mac while laptop is closed, system does hibernation. This native call hang is the first thing in the morning that greets me almost every day. But it also happens in a steady state sporadically.

  23. vors commented on Sep 28, 2018

    @vors
    CollaboratorAuthor

    I stop seeing this recently. Perhaps dotnet finally get around to solve it.

  24. SteveL-MSFT commented on Sep 28, 2018

    @SteveL-MSFT
    Member

    I haven't experienced myself in a long time. Let's close this and if it repros we can reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions