Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 481420

Summary: [refs] Exception in walk.js
Product: [ECD] Orion Reporter: Silenio Quarti <Silenio_Quarti>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: Michael_Rennie
Version: 11.0   
Target Milestone: 11.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Silenio Quarti CLA 2015-11-04 10:16:45 EST
Open gitCommands.js;
Find a call to progress.progress(). There is one in line#274.
Search for references.

Progress gets stuck with this message:

References found in file: 'explorer-table.js' (580/1447)

Console has many errors like this one:

Uncaught TypeError: Cannot read property 'type' of nullc
	@ walk.js:36simple
	@ walk.js:40astSize
	@ tern.js:445chargeOnBudget
	@ tern.js:469analyzeAll
	@ tern.js:332done
	@ tern.js:300signal
	@ signal.js:19signal.mixin.finishAsyncAction
	@ tern.js:169(anonymous function)
	@ resolver.js:58_getFile
	@ ternWorkerCore.js:617resolve
	@ resolver.js:52resolveDependencies
	@ resolver.js:33doPostParse
	@ resolver.js:126postParse
	@ node.js:231runPasses
	@ infer.js:1271exports.parse
	@ infer.js:1320(anonymous function)
	@ tern.js:79exports.withContext
	@ infer.js:760updateText
	@ tern.js:78ensureFile
	@ tern.js:260signal.mixin.addFile
	@ tern.js:117getInterface
	@ requirejs.js:76interf
	@ requirejs.js:120(anonymous function)
	@ requirejs.js:130exports.IsCallee.constraint.addType
	@ infer.js:368withWorklist
	@ infer.js:800extend.propagate
	@ infer.js:91(anonymous function)
	@ infer.js:1179(anonymous function)
	@ infer.js:1018infer
	@ infer.js:1211walk.make.Expression
	@ infer.js:1217c
	@ walk.js:68base.ExpressionStatement.base.ParenthesizedExpression
	@ walk.js:185c
	@ walk.js:68skipThrough
	@ walk.js:168c
	@ walk.js:68base.Program.base.BlockStatement
	@ walk.js:179c
	@ walk.js:68recursive
	@ walk.js:69exports.analyze
	@ infer.js:1365(anonymous function)
	@ tern.js:233exports.withContext
	@ infer.js:760analyzeFile
	@ tern.js:230analyzeAll
	@ tern.js:339done
	@ tern.js:300signal
	@ signal.js:19signal.mixin.finishAsyncAction
	@ tern.js:169(anonymous function)
	@ tern.js:269onmessage
	@ ternWorkerCore.js:525
logger.js:26
ErrorEvent {isTrusted: true}bubbles: falsecancelBubble: falsecancelable: truecolno: 32currentTarget: WorkerdefaultPrevented: falseerror: nulleventPhase: 0filename: "https://beta3.hub.jazz.net/code/acorn/dist/walk.js"isTrusted: trueisTrusted: truelineno: 36message: "Uncaught TypeError: Cannot read property 'type' of null"path: Array[0]returnValue: truesrcElement: Workertarget: WorkertimeStamp: 1446649816271type: "error"__proto__: ErrorEvent
Comment 1 Michael Rennie CLA 2015-11-05 10:47:22 EST
Looks like the backing AST is null for file:

"/file/mrennie-OrionContent/org.eclipse.orion.client/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer.js"

and the server is reporting the last error as: "Failed to read file socket.io/socket.io".
Comment 2 Michael Rennie CLA 2015-11-05 13:43:52 EST
Pushed fix to:

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=bac076e9b5be98d4ef44b14b513f556a6c382448

for requirejs paths, our new support to ignore looking up plugin-prefixed logical paths had a quirk, where if the last path loaded by Tern was one of these paths it would trigger the everythingLoaded event, which did not cause addFile / ensureFile to be called on it, which in turn cause the file to have no AST, which caused the exception.
Comment 3 Michael Rennie CLA 2015-11-05 17:36:34 EST
I pushed an updated fix:

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=a5401a0c74a47b25672ad7aecfa0265be7f67807

the old fix had a bug in it for files that used both requirejs and nodejs at the same time - some types could be mis-propagated, resulting in bad open decl / impl and content assist.