Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spawning git crashes extension host #32739

Closed
aman-manocha opened this issue Aug 17, 2017 · 22 comments
Closed

Spawning git crashes extension host #32739

aman-manocha opened this issue Aug 17, 2017 · 22 comments
Assignees
Labels
git GIT issues windows VS Code on Windows issues
Milestone

Comments

@aman-manocha
Copy link

  • VSCode Version: Code 1.15.1 (41abd21, 2017-08-16T18:07:25.676Z)
  • OS Version: Windows_NT x64 10.0.15063
  • Extensions: none

Steps to Reproduce:

  1. Run visual studio code on Windows 10
  2. Click on "reload" button results in same error again
  3. Rebooting/re-install doesn't help
@vscodebot vscodebot bot added extensions Issues concerning extensions new release labels Aug 17, 2017
@alexdima
Copy link
Member

alexdima commented Aug 18, 2017

@aman-manocha

Are you using the 64-bit version of VS Code or the 32-bit version ? Does this reproduce in both the 32-bit version and the 64-bit version ? Does this reproduce when running code --disable-extensions ?

When the error is shown, can you please open the Developer Tools (Help > Toggle Developer Tools) and check if there is any additional information in there?

@alexdima alexdima added the info-needed Issue requires more information from poster label Aug 18, 2017
@alexdima alexdima added this to the Backlog milestone Aug 18, 2017
@aman-manocha
Copy link
Author

I am using 64-bit version of VS Code.
I didn't try 32-bit version.
I didn't install any extensions.
No additional information in Dev Tools

@Edmanbosch
Copy link

Edmanbosch commented Aug 20, 2017

I also seem to keep getting this issue, it's weird since it used to never happen. It also seems to disappear when I remove the "git" folder from the install folder.

@alexdima
Copy link
Member

@aman-manocha Can you consistently reproduce this? Even when opening a new empty window (i.e. File > New Window) ? or is it something reproducing only for a certain folder ?

@Edmanbosch
Copy link

Edmanbosch commented Sep 28, 2017

Apparently, the reason why I got this error was because I didn't have git installed on my computer. After installing git it worked fine, even if I had the git folder inside my installation. If git is something required for VS Code, then it should be made a bit more obvious.

@joaomoreno
Copy link
Member

This is very strange. @Edmanbosch let me ask you a favour: if you uninstall Git, does the issue start happening again?

@Edmanbosch
Copy link

So, I just uninstalled git, got the issue again. I installed git again and the issue was gone.

@joaomoreno
Copy link
Member

Awesome! What's your exact OS?

@Edmanbosch
Copy link

Well, I'm using Windows 10.

@joaomoreno
Copy link
Member

@Z-starts
Copy link

Z-starts commented Oct 3, 2017

@joaomoreno
image
installed git and the issue was gone.

@Edmanbosch
Copy link

@joaomoreno Ah, sorry. The version number is 1703, with the build number being 15063.608.

@joaomoreno
Copy link
Member

joaomoreno commented Nov 1, 2017

@Edmanbosch @Z-starts @aman-manocha

I got something else to try. Uninstall git, make sure you still get the issue. Then, edit app/extensions/git/out/git.js (within VS Code's installation folder) and comment out the following line. It should be around line 82.

        .then(void 0, () => findSpecificGit('git'));

Does the issue still reproduce with that commented out?

@joaomoreno
Copy link
Member

joaomoreno commented Nov 1, 2017

@alexandrudima I could confirm what you saw in Procmon. Consider the following code:

function findGitWin32(): Promise<IGit> {
	return findSystemGitWin32(process.env['ProgramW6432'])
		.then(void 0, () => findSystemGitWin32(process.env['ProgramFiles(x86)']))
		.then(void 0, () => findSystemGitWin32(process.env['ProgramFiles']))
		.then(void 0, () => findSpecificGit('git'));
}

When git is not installed, that code will trickle down to findSpecificGit('git') which will simply do cp.spawn('git'...). In my machine, I can see that Node loops through all the paths in %PATH% and appends git.com and git.exe to them and tries to spawn that.

image

It could be that in these user's machines this will spawn something other than git but called the same way, causing the crash.

I want to wait for a reply from @Edmanbosch @Z-starts @aman-manocha but my gut feeling tells me to simply delete that last fallback case. If users install git on a different path other than the default ones, we have the git.path setting for that. What do you think?

@Edmanbosch
Copy link

Just tried it out, and VS Code loads and gives me zero problems.

@joaomoreno
Copy link
Member

That's awesome. How about this build? Still no problem?

@alexdima
Copy link
Member

alexdima commented Nov 2, 2017

@joaomoreno Perhaps you could spawn where git and then check if there is a cmd\git.exe in the path ?

@joaomoreno
Copy link
Member

@alexandrudima I'd actually be comfortable removing that find git wherever code altogether. That build I linked to in the previous commit does that. 👍

@Edmanbosch
Copy link

Edmanbosch commented Nov 2, 2017

@joaomoreno That build works perfectly fine, even without having git installed.

@joaomoreno
Copy link
Member

@aman-manocha Wanna give it a try?

@joaomoreno joaomoreno modified the milestones: Backlog, November 2017 Nov 10, 2017
@joaomoreno joaomoreno added git GIT issues windows VS Code on Windows issues and removed extensions Issues concerning extensions info-needed Issue requires more information from poster labels Nov 10, 2017
@joaomoreno joaomoreno changed the title Extension host terminated unexpectedly. Please reload the window to recover. Spawning git crashes extension host Nov 10, 2017
@euk-anthonyb
Copy link

Same extension error occurs in the Insiders version. :(

image

image

@Tyriar
Copy link
Member

Tyriar commented Dec 14, 2017

Git installed for specific user is no longer picked up because of this change, see #40229

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
git GIT issues windows VS Code on Windows issues
Projects
None yet
Development

No branches or pull requests

8 participants