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

[electron] Update Theia to use Electron 3.x and Node 10.x #4750

Merged
merged 2 commits into from Apr 8, 2019

Conversation

thegecko
Copy link
Member

@thegecko thegecko commented Mar 28, 2019

This fixes #2009, #3729

The PR brings in changes to update Theia to Electron 3, which specifically uses:

  • Node 10.2.0
  • Chrome 66
  • V8 6.6

Please discuss impact concerns below.

It also updates the minimum node version used by Theia to v10.x.x

To do:

  • Await 0.5 release
  • Add update to CHANGELOG mentioning breaking changes
  • Update docs to use Node 10
  • Create CQ for wdio-mocha-framework: 0.6.4 (dev dependency]
  • Create CQ for vscode-nsfw: 1.1.2 (nsfw 1.1.2 just merged into master)
  • Create CQ for Electron: 3.17 [@thegecko]
  • Fix tests
  • Await CQ for Electron: 3.17: CQ 19441

cc @debovema

@akosyakov
Copy link
Member

Generally, we (TypeFox) are for it, but could we hold it for one week till next Saturday? We have some releases depending on next, switching to node 10 could cause problems for them. After that we can merge it and land in April 0.6.0 release. bwt please update CHANGELOG with 0.6.0 breaking change, since we don't support node 8

Not sure how going for node 10 affects other products. @benoitf @caseyflynn-google

@thegecko
Copy link
Member Author

but could we hold it for one week till next Saturday?

Absolutely

@marcdumais-work
Copy link
Contributor

It also updates the minimum node version used by Theia to v10.x.x

That's a very important detail; maybe squeeze a mention in the PR's label to that it's clear and people will know this is tentatively coming soon?

@thegecko thegecko changed the title [electron] Update Theia to use Electron 3 [electron] Update Theia to use Electron 3.x and Node 10.x Mar 28, 2019
@debovema debovema mentioned this pull request Mar 28, 2019
@marcdumais-work
Copy link
Contributor

Create CQ for wdio-mocha-framework: 0.6.4

This one is not necessary: it's a test/build dependency, already covered by a CQ, for "version: 0.5.9 and later versions"

@thegecko
Copy link
Member Author

@thegecko thegecko force-pushed the electron-3 branch 4 times, most recently from d7f4d6c to 116625e Compare April 1, 2019 15:20
.travis.yml Show resolved Hide resolved
@@ -174,8 +174,7 @@ describe('Tree', () => {
const expectedRefreshedNodes = new Set([
retrieveNode<CompositeTreeNode>('1'),
retrieveNode<CompositeTreeNode>('1.1'),
retrieveNode<CompositeTreeNode>('1.2'),
retrieveNode<CompositeTreeNode>('1.2.1')]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a race condition here where not all nodes are deleted before the refresh() promise returns.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a hard time with this one but why this test was OK before migration to node 10 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the race simply gets further in different Node versions :/

@thegecko
Copy link
Member Author

thegecko commented Apr 1, 2019

This is ready for review, pending the CQ being approved.

Some guidance/help on the commented test would be really useful.

cc @marcdumais-work , @akosyakov

@paul-marechal
Copy link
Member

paul-marechal commented Apr 2, 2019

https://nodejs.org/docs/latest-v10.x/api/child_process.html#child_process_subprocess_connected

Maybe Node's child_process module behaves differently now. From my tests, in the RawProcess class the process object is actually created, but its .connected value is false, and the stdio pipes are left undefined on said object. Maybe just add a test for that, and break out by throwing a synchronous error (so that the RawProcess streams are set to something not undefined?

Signed-off-by: Rob Moran <rob.moran@arm.com>
@thegecko
Copy link
Member Author

thegecko commented Apr 2, 2019

Thanks @marechal-p . It transpires the process pipes are undefined in Node 10 when using a non-executable command.

@thegecko
Copy link
Member Author

thegecko commented Apr 2, 2019

Tests fixed and PR ready for final review.

@akosyakov
Copy link
Member

@thegecko we will try on Monday, busy with internal releases

@@ -106,7 +106,7 @@ export class MarkdownPreviewHandler implements PreviewHandler {
if (!elementToReveal) {
return;
}
elementToReveal.scrollIntoView({ behavior: 'instant' });
elementToReveal.scrollIntoView();
Copy link
Member

@akosyakov akosyakov Apr 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlexTugarev What are consequences of this change? Could you review the preview extension in this PR?

I wonder why it's affected. It's not part of Node.js, but DOM api.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akosyakov, instant scroll behavior was experimental, apparently they removed it leaving smooth and auto. this change shouldn't make any difference.

fyi, instant was in place just to make sure it isn't using smooth by default, which would be bogus as it's not an atomic operation.

Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
@akosyakov
Copy link
Member

The browser version works nicely in Gitpod. Checking Electron locally. @kittaakos could you check as well?

@akosyakov
Copy link
Member

@thegecko I've pushed one commit to update Gitpod. fix #4818

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works nicely for me in local Electron as well. Tested that typescript language support is there and Node.js debugging works. The only issue i've stumbled upon that yarn start picks up wrong Node.js version, so has to start with npx theia start.

@akosyakov
Copy link
Member

akosyakov commented Apr 8, 2019

Does any have objections to merge it or concerns regarding what can go wrong? It's time for testing.

@vince-fugnitto
Copy link
Member

@thegecko @akosyakov I tried running the example-electron application and was unsuccessful.
I ran both yarn start and npx theia start but no luck :(

I've tried both on macOS and Ubuntu using Node v10.15.3. Perhaps I am doing something wrong.

(electron-3 ✓) npx theia start
Starting the master backend process with 5000 (ms) timeout.
Starting server worker...
Server worker has been started. [ID: 1 | PID: 6979]
/home/evinfug/workspace/electron-theia/theia/node_modules/electron/dist/electron: symbol lookup error: /home/evinfug/workspace/electron-theia/theia/node_modules/nsfw/build/Release/nsfw.node: undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE
Server worker has been disconnected. [ID: 1 | PID: 6979]
Server worker failed to start within 5000 milliseconds.
Pass a greater value as '--startup-timeout' option to increase the timeout or a negative to disable.
/home/evinfug/workspace/electron-theia/theia/node_modules/electron/dist/electron /home/evinfug/workspace/electron-theia/theia/examples/electron/src-gen/frontend/electron-main.js: symbol lookup error: /home/evinfug/workspace/electron-theia/theia/node_modules/nsfw/build/Release/nsfw.node: undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE

@thegecko
Copy link
Member Author

thegecko commented Apr 8, 2019

@vince-fugnitto did you run yarn rebuild:electron first?

@vince-fugnitto
Copy link
Member

@vince-fugnitto did you run yarn rebuild:electron first?

Thank you @thegecko, forgot about that!

- init: yarn install
command: cd examples/browser && yarn start --hostname 0.0.0.0 ../..
- init: nvm install 10 && nvm use 10 && yarn
command: yarn --cwd examples/browser start ../..
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will eventually fix #4818 too but you have to restore --hostname 0.0.0.0, don't you?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gitpod is capable to auto expose localhost now, providing hostname is redundant.

@@ -1,8 +1,8 @@
ports:
- port: 3000
tasks:
- init: yarn install
command: cd examples/browser && yarn start --hostname 0.0.0.0 ../..
- init: nvm install 10 && nvm use 10 && yarn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do not we install 10.15.3 if the documentation says: "Preferably, use version 10.15.3"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what issues do you see with using latest node 10? before we were using latest node 8, seemed to work just fine

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's the same in travis config btw

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just do not understand why do we recommend a version in the documentation but do not stick to it in the gitpod script.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Electron ships with Node 10.15.3, there is a slight danger you could introduce incompatibilities if you build using a newer version, however I wouldn't want to restrict people to a specific release otherwise.

This was the same with Electron 2, you can't override the node version it uses.

IMO, the current set up gives the user the right amount of flexibility.

@kittaakos
Copy link
Contributor

I can see the followings logged in the browser console after starting the electron application from this branch. Does anyone know where do they come from?

internal/process/warning.js:18 (node:5213) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
writeOut @ internal/process/warning.js:18
/Users/akos.kitta/git/theia/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/renderer/security-warnings.js:184 Electron Security Warning (Insecure Content-Security-Policy) This renderer process has either no Content Security
      Policy set or a policy with "unsafe-eval" enabled. This exposes users of
      this app to unnecessary security risks.

Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried it locally, checked the TS-LS; it worked.

I have seen this when I closed the browser windows:

Attempting to call a function in a renderer window that has been closed or released.
Function provided here: 41.bundle.js:547:27
root INFO Stopped watching the git repository: file:///Users/akos.kitta/git/theia
Attempting to call a function in a renderer window that has been closed or released.
Function provided here: 41.bundle.js:547:27
Attempting to call a function in a renderer window that has been closed or released.
Function provided here: 41.bundle.js:547:27

@thegecko
Copy link
Member Author

thegecko commented Apr 8, 2019

I have seen this when I closed the browser windows

I believe this also exists on master.

@thegecko
Copy link
Member Author

thegecko commented Apr 8, 2019

@kittaakos I've created a separate issue to remove the usage of Buffer(): #4840

@thegecko
Copy link
Member Author

thegecko commented Apr 8, 2019

All concerns seem to be dealt with, I'm merging this.

@akosyakov
Copy link
Member

We should update next images in theia-apps: https://github.com/theia-ide/theia-apps/tree/master/theia-docker We've overlooked it and broke all of them with this PR!

@thegecko
Copy link
Member Author

thegecko commented Apr 9, 2019

Should be a simple change to use node 10 alpine. I've created an issue, although I can't modify the labels.

@akosyakov
Copy link
Member

@thegecko the time consuming part is to test that they build and start properly, and that a change does not affect latest images (using 0.5.0)

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

Successfully merging this pull request may close these issues.

Theia does not run with Node.js v10.3.0
8 participants