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

Experiencing Intermittent IDE Crashes with NodeJS Tools 1.1 #664

Closed
charliedavison opened this issue Jan 18, 2016 · 11 comments
Closed

Experiencing Intermittent IDE Crashes with NodeJS Tools 1.1 #664

charliedavison opened this issue Jan 18, 2016 · 11 comments

Comments

@charliedavison
Copy link

Hi,

Every developer in our department working with our Javascript project using NodeJS tools is currently experiencing intermittent crashes during development.

Some investigation shows that the crash does not appear in the ActivityLog.xml file, however it does log an event in the event viewer -

Application: devenv.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.InvalidCastException at Microsoft.NodejsTools.Analysis.NodejsModuleBuilder.FsReadDirSync(Microsoft.NodejsTools.Analysis.Values.FunctionValue, Microsoft.NodejsTools.Parsing.Node, Microsoft.NodejsTools.Analysis.AnalysisUnit, Microsoft.NodejsTools.Analysis.IAnalysisSet, Microsoft.NodejsTools.Analysis.IAnalysisSet[]) at Microsoft.NodejsTools.Analysis.Values.SpecializedFunctionValue.Call(Microsoft.NodejsTools.Parsing.Node, Microsoft.NodejsTools.Analysis.AnalysisUnit, Microsoft.NodejsTools.Analysis.IAnalysisSet, Microsoft.NodejsTools.Analysis.IAnalysisSet[]) at Microsoft.NodejsTools.Analysis.AnalysisSetExtensions.Call(Microsoft.NodejsTools.Analysis.IAnalysisSet, Microsoft.NodejsTools.Parsing.Node, Microsoft.NodejsTools.Analysis.AnalysisUnit, Microsoft.NodejsTools.Analysis.IAnalysisSet, Microsoft.NodejsTools.Analysis.IAnalysisSet[]) at Microsoft.NodejsTools.Analysis.Values.PropertyDescriptorValue.GetValue(Microsoft.NodejsTools.Parsing.Node, Microsoft.NodejsTools.Analysis.AnalysisUnit, Microsoft.NodejsTools.Analysis.ProjectEntry, Microsoft.NodejsTools.Analysis.IAnalysisSet, Boolean) at Microsoft.NodejsTools.Analysis.Values.ExpandoValue.Get(Microsoft.NodejsTools.Parsing.Node, Microsoft.NodejsTools.Analysis.AnalysisUnit, System.String, Boolean) at Microsoft.NodejsTools.Analysis.Values.ObjectValue.Get(Microsoft.NodejsTools.Parsing.Node, Microsoft.NodejsTools.Analysis.AnalysisUnit, System.String, Boolean) at Microsoft.NodejsTools.Analysis.Values.FunctionValue.Get(Microsoft.NodejsTools.Parsing.Node, Microsoft.NodejsTools.Analysis.AnalysisUnit, System.String, Boolean) at Microsoft.NodejsTools.Analysis.AnalysisSetExtensions.Get(Microsoft.NodejsTools.Analysis.IAnalysisSet, Microsoft.NodejsTools.Parsing.Node, Microsoft.NodejsTools.Analysis.AnalysisUnit, System.String, Boolean) at Microsoft.NodejsTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateMember(Microsoft.NodejsTools.Analysis.Analyzer.ExpressionEvaluator, Microsoft.NodejsTools.Parsing.Node) at Microsoft.NodejsTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateWorker(Microsoft.NodejsTools.Parsing.Node) at Microsoft.NodejsTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateReference(Microsoft.NodejsTools.Parsing.Node, Microsoft.NodejsTools.Parsing.CallNode, Microsoft.NodejsTools.Analysis.IAnalysisSet ByRef) at Microsoft.NodejsTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateCall(Microsoft.NodejsTools.Analysis.Analyzer.ExpressionEvaluator, Microsoft.NodejsTools.Parsing.Node) at Microsoft.NodejsTools.Analysis.Analyzer.ExpressionEvaluator.EvaluateWorker(Microsoft.NodejsTools.Parsing.Node) at Microsoft.NodejsTools.Analysis.Analyzer.DDG.Walk(Microsoft.NodejsTools.Parsing.VariableDeclaration) at Microsoft.NodejsTools.Parsing.VariableDeclaration.Walk(Microsoft.NodejsTools.Parsing.AstVisitor) at Microsoft.NodejsTools.Parsing.Var.Walk(Microsoft.NodejsTools.Parsing.AstVisitor) at Microsoft.NodejsTools.Analysis.Analyzer.DDG.Walk(Microsoft.NodejsTools.Parsing.Block) at Microsoft.NodejsTools.Parsing.Block.Walk(Microsoft.NodejsTools.Parsing.AstVisitor) at Microsoft.NodejsTools.Parsing.JsAst.Walk(Microsoft.NodejsTools.Parsing.AstVisitor) at Microsoft.NodejsTools.Analysis.AnalysisUnit.AnalyzeWorker(Microsoft.NodejsTools.Analysis.Analyzer.DDG, System.Threading.CancellationToken) at Microsoft.NodejsTools.Analysis.Analyzer.DDG.Analyze(Microsoft.NodejsTools.Analysis.Deque1<Microsoft.NodejsTools.Analysis.AnalysisUnit>, System.Threading.CancellationToken)
at Microsoft.NodejsTools.Analysis.JsAnalyzer.AnalyzeQueuedEntries(System.Threading.CancellationToken)
at Microsoft.NodejsTools.Intellisense.VsProjectAnalyzer+AnalysisQueue+GroupAnalysis.Analyze(System.Threading.CancellationToken)
at Microsoft.NodejsTools.Intellisense.VsProjectAnalyzer+AnalysisQueue.Worker(System.Object)
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart(System.Object)
`

We are currently using NodeJS Tools 1.1, with Visual Studio 2015 Update 1, however we were experiencing the same issue with the original version of VS2015.

Has anyone seen or experienced anything like this? It is currently forcing us to use an alternative editor and only use VS for checking in code as the IDE is unusable in such an unstable state.

@jwuliger
Copy link

@charliedavison Welcome to the club man. I know how you feel. This is what is happening for me: Issue #663 😞

@charliedavison
Copy link
Author

@jaredpar Glad I'm not the only one, hoping the additional Stack Trace information will shed some light!

@mousetraps
Copy link
Contributor

@charliedavison thanks for the stack trace! Looks like the problem is stemming from the cast at:
https://github.com/Microsoft/nodejstools/blob/fd59a1d39db29a69699dc33cca41b9f3b52da428/Nodejs/Product/Analysis/Analysis/NodejsModuleBuilder.Specializations.cs#L344

I'm not entirely sure why it's getting into an invalid state here, though. In any case we're planning to put out a hotfix to 1.1 soon, so we can try to pull in this change as well.

@jwuliger we can't really be sure if it's the same issue without a stack trace, so don't get your hopes up just yet 😜

@charliedavison
Copy link
Author

@mousetraps Thanks for getting back to me! If there's any other information I can give you that might help, please just let me know.

@mousetraps
Copy link
Contributor

@charliedavison any chance you could also post your package.json file so we can better understand the root cause?

@garyland
Copy link

@mousetraps here is a copy of the package.json file that @charliedavison and myself are using. Thanks for the help.

{
"name": "g2restai",
"version": "1.0.0",
"description": "",
"main": "./server/index.js",
"author": "",
"license": "ISC",
"scripts": {
"test": "karma start karma.conf.js"
},
"dependencies": {
"babel": "^5.8.23",
"body-parser": "^1.14.1",
"bootstrap": "^3.3.6",
"browserify": "^12.0.1",
"chai": "^3.4.1",
"cookie-parser": "^1.4.0",
"dateformat": "^1.0.12",
"expect": "^1.12.2",
"express": "^4.13.3",
"express-session": "^1.12.1",
"flux": "^2.1.1",
"fs": "0.0.2",
"gridfs-stream": "^1.1.1",
"gulp": "^3.9.0",
"gulp-util": "^3.0.7",
"gulp-zip": "^3.0.2",
"history": "=1.17.0",
"jasmine": "^2.4.1",
"jasmine-core": "^2.4.1",
"jquery": "=2.1.4",
"jquery-ui": "^1.10.5",
"jsdom": "^7.2.0",
"karma": "^0.13.19",
"karma-browserify": "^4.4.2",
"karma-chrome-launcher": "^0.2.2",
"karma-coverage": "^0.5.3",
"karma-jasmine": "^0.2.2",
"karma-junit-reporter": "^0.3.8",
"karma-phantomjs-launcher": "^0.2.3",
"karma-phantomjs-shim": "^1.2.0",
"keymirror": "^0.1.1",
"mongoose": "^4.2.8",
"object-assign": "^4.0.1",
"passport": "^0.3.2",
"passport-local": "^1.0.0",
"passport-local-mongoose": "^3.1.0",
"phantomjs": "^1.9.19",
"promise-polyfill": "^2.1.0",
"react": "^0.14.3",
"react-addons-test-utils": "^0.14.0",
"react-dom": "^0.14.3",
"react-router": "^1.0.0",
"reactify": "^1.1.1",
"underscore": "^1.8.3",
"vinyl-source-stream": "^1.1.0"
},
"devDependencies": {
"karma-junit-reporter": "^0.3.8"
}
}

@charliedavison
Copy link
Author

Hi @mousetraps, I just wanted to see if this was still any chance of this being up for inclusion in the 1.1 hot fix? Is there any other information I can give that might be useful?

@mousetraps
Copy link
Contributor

@charliedavison yep, we'll try to include this fix 😃

@mousetraps mousetraps added this to the March milestone Mar 13, 2016
@mjbvz
Copy link
Contributor

mjbvz commented Mar 16, 2016

I haven't been able to repo with the provided package.json yet, but I suspect that the issue is that one of these node packages is using fs.readdirSync differently than we expect (i.e., not just calling it). When the analyzer finds this usage, it crashes on the cast.

Again, without a repo, I can't be 100% sure this is the root cause, but using a safe cast may very well fix the problem. It shouldn't make anything more broken at least.

I'll submit a PR shortly.

@mjbvz mjbvz closed this as completed in df2e33a Mar 17, 2016
mjbvz added a commit that referenced this issue Mar 17, 2016
Use safe cast for fsReadDirSync impl to try to fix #664 

Fixed `FsBasename` too. Its cast didn't seem to be needed actually. I don't see any other cases with this pattern in this file, but will keep an eye out.
@mjbvz
Copy link
Contributor

mjbvz commented Mar 17, 2016

I've merged in the potential fix and the change should make it into our next preview build.

Again, because I wasn't able to get a repo, I can't be 100% sure this will fix the original problem. If you notice this is still happening when using next preview build, please reopen the issue.

@mousetraps
Copy link
Contributor

We're also planning to cherry-pick these changes for inclusion in our v1.1 patch release.

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

No branches or pull requests

5 participants