| Summary: | Error running lint because the tern server is not started | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Olivier Thomann <Olivier_Thomann> | ||||||||||
| Component: | JS Tools | Assignee: | Michael Rennie <Michael_Rennie> | ||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||
| Severity: | major | ||||||||||||
| Priority: | P3 | CC: | curtis.windatt.public, Michael_Rennie, steve_northover | ||||||||||
| Version: | 11.0 | ||||||||||||
| Target Milestone: | 12.0 | ||||||||||||
| Hardware: | PC | ||||||||||||
| OS: | Windows 7 | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
I pushed some dark-launched tracing to master so we can record what is happening: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=8a545700ef6c63d0b6d0b42fc85d502c08d40c10 To activate the tracing, open the dev console and enter the following: localStorage.js_message_trace="true" hit enter, close the dev tools, and reload the page. Reopen the dev tools after the page loads and you see the error - should have the trace in the console. Created attachment 260069 [details]
Updated patch
Patch from Michael
After testing a build that contains the fix on beta3, the problem seems to be gone. Closing as fixed. Still happening to me. Will debug with Olivier. Created attachment 260350 [details]
debug output
Here is a simplified trace:
postMessage (0) - MESSAGE QUEUED: {"request":"lint"}}
worker_ready (0): {"request":"worker_ready"}
postMessage (1) - SENT {"request":"start_server","args":{"initial":true},"messageID":0}
server_ready (1): {"request":"start_server","state":"server_ready","messageID":0}
clearing MESSAGE queue: {"request":"lint"}
postMessage (2) - SENT {"request":"lint"}
postMessage (3) - SENT {"request":"start_server","args":{"options":{"libs":["ecma5"],"ecmaVersion":5,"loadEagerly":["/file/snorthov-OrionContent/minesweeper-objects/public/index.html"]}},"messageID":2}
server_ready (3): {"request":"start_server","state":"server_ready","messageID":2}
postMessage (3) - SENT {"request":"read"}
postMessage (3) - SENT {"request":"read"}
postMessage (3) - SENT {"request":"read"}
postMessage (3) - SENT {"request":"read"}
The initial start up is flushing the message queue before the tern-project file is being used.
I think we need to get rid of the 'initial' start up and have the ternProjectManager always be the only thing that requests server starts. So rather than having a default that is sent when the JS bundle loads (the root problem here) now start up requests will be sent until the manager loads and asks for one. The only thing we would need to change would be to remove the initial junk (and checks) from javaScriptPlugin.js and add a condition in the manager that when we don;t have a .tern-project file, request a default start up Created attachment 260363 [details]
proposed fix
The patch changes how the Tern server is started - moving all the logic to the tern project manager. With this patch I only ever get one start_server request, regardless of it being initial startup, or a project switch. There is no more "plugin load start up" request being done.
Created attachment 260364 [details]
updated fix
Same fix as the previous patch, but updates the tracing to get rid of the excessive JSON output that makes it almost impossible to understand whats happening...
I pushed the second patch to: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=68588f30d24d6411ba03f48d58d7f0143e58bcec after Olivier helped confirm the start up sequence was correct. I'll leave this open until we get a few tracings from beta3. Trace from orion.eclipse.org:
postMessage (0) - MESSAGE QUEUED: lint
javascriptPlugin.js:182 worker_ready (0): worker_ready
javascriptPlugin.js:149 postMessage (0) - START {"options":{"libs":["browser","ecma5","angular"],"loadEagerly":["/file/mrennie-OrionContent/angular-demo/public/index.html"]}}
javascriptPlugin.js:195 server_ready (0): start_server
javascriptPlugin.js:304 clearing MESSAGE queue: lint
javascriptPlugin.js:141 postMessage (1) - SENT lint
javascriptPlugin.js:141 postMessage (1) - SENT read
javascriptPlugin.js:141 postMessage (1) - SENT read
Trace from beta3:
postMessage (0) - MESSAGE QUEUED: lint
javascriptPlugin.js:182 worker_ready (0): worker_ready
javascriptPlugin.js:149 postMessage (0) - START {"options":{"libs":["browser","ecma5","angular"],"loadEagerly":["/code/file/mrennie-OrionContent/snorthov | angular-demo/public/index.html"]}}
javascriptPlugin.js:195 server_ready (0): start_server
javascriptPlugin.js:304 clearing MESSAGE queue: lint
javascriptPlugin.js:141 postMessage (1) - SENT lint
javascriptPlugin.js:141 postMessage (1) - SENT read
javascriptPlugin.js:141 postMessage (1) - SENT read
Closing fixed. The trace is identical now across all servers / platforms |
On beta3, this is visible only if the debugger is not started. 1) get minesweeper-objects 2) make sure there is a .tern-project file { "plugins": {}, "libs": ["ecma5"], "ecmaVersion": 5, "loadEagerly": [ "public/index.html" ] } 3) click on main.js You can see errors and warnings properly reported. 4) Refresh the page. 5) Sometimes you get an error saying the ESLint failed to validate the file because the tern server has not been started. I need to see how it is possible that the server is not started when the lint request that comes from the validator is run. The change for bug 488530 was to enforce that the tern server is restarted when the .tern-project file is added. Any requests made before the server is started were supposed to be queued. Now it looks like the lint request is run when no tern server is available.