Skip to content

Implement LegacyService. Use core to start legacy Kibana. #22190

Merged
azasypkin merged 19 commits intoelastic:masterfrom
azasypkin:issue-xxx-core-legacy-service
Sep 6, 2018
Merged

Implement LegacyService. Use core to start legacy Kibana. #22190
azasypkin merged 19 commits intoelastic:masterfrom
azasypkin:issue-xxx-core-legacy-service

Conversation

@azasypkin
Copy link
Copy Markdown
Contributor

@azasypkin azasypkin commented Aug 20, 2018

This PR implements LegacyService that will bridge core with "legacy" Kibana. And now core starts "legacy" Kibana!

How to test: everything should work as before, if you notice a difference - that's probably a bug.

Blocked by #21956
Unblocks #19994

Fixes #19324
Fixes #15888

@azasypkin azasypkin added blocked Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// Feature:New Platform v6.5.0 labels Aug 20, 2018
@azasypkin azasypkin force-pushed the issue-xxx-core-legacy-service branch 2 times, most recently from de1c380 to 22d0f4e Compare August 22, 2018 10:22
@azasypkin azasypkin force-pushed the issue-xxx-core-legacy-service branch 7 times, most recently from a3bd81c to ab19b31 Compare August 24, 2018 08:41
@azasypkin azasypkin changed the title [skip ci] Implement LegacyService. Use core to start legacy Kibana. Implement LegacyService. Use core to start legacy Kibana. Aug 24, 2018
@azasypkin azasypkin force-pushed the issue-xxx-core-legacy-service branch from ab19b31 to 3c03da9 Compare August 24, 2018 18:01
@elasticmachine

This comment has been minimized.

@azasypkin azasypkin force-pushed the issue-xxx-core-legacy-service branch from 3c03da9 to f9103f3 Compare August 24, 2018 20:44
@elasticmachine

This comment has been minimized.

@azasypkin azasypkin force-pushed the issue-xxx-core-legacy-service branch from f9103f3 to 5ce283a Compare August 24, 2018 23:54
@elasticdog

This comment has been minimized.

@elasticmachine

This comment has been minimized.

@azasypkin azasypkin force-pushed the issue-xxx-core-legacy-service branch from 5ce283a to d4f49aa Compare August 25, 2018 12:25
@elasticmachine

This comment has been minimized.

@azasypkin azasypkin force-pushed the issue-xxx-core-legacy-service branch from d4f49aa to dbeae23 Compare August 25, 2018 12:38
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@azasypkin azasypkin force-pushed the issue-xxx-core-legacy-service branch from dbeae23 to b8ecb64 Compare August 27, 2018 14:45
@azasypkin
Copy link
Copy Markdown
Contributor Author

@spalger resolved conflicts, handled some comments and left questions for the others :)

Copy link
Copy Markdown
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

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

Code is looking great, but I'm getting the following when running this locally:

~/kbn-dev/master/kibana (pr/22190) $ node scripts/kibana --dev
 watching for changes  (1735 files)
(node:39180) UnhandledPromiseRejectionWarning: Error: listen EADDRINUSE 127.0.0.1:5601
    at Object._errnoException (util.js:992:11)
    at _exceptionWithHostPort (util.js:1014:20)
    at Server.setupListenHandle [as _listen2] (net.js:1355:14)
    at listenInCluster (net.js:1396:12)
    at GetAddrInfoReqWrap.doListen (net.js:1505:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)
(node:39180) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:39180) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:39181) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
(node:39182) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.

update: Turns out this was caused by an SSH tunnel I had running on 5601, but it seems like an issue that this caused a bunch of unhandled promise rejections

this.addedCount = 0;
this.inReplMode = !!opts.repl;
this.basePathProxy = basePathProxy;
this.config = config;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like we don't use this.config

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍 will remove it.

async function makeRequest(opts) {
return await kbnTestServer.makeRequest(kbnServer, opts);
}
}, 30000);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd say move it to integration tests, just not sure why it would take 16 seconds to start a server...

@azasypkin
Copy link
Copy Markdown
Contributor Author

azasypkin commented Sep 6, 2018

update: Turns out this was caused by an SSH tunnel I had running on 5601, but it seems like an issue that this caused a bunch of unhandled promise rejections

I believe this behavior was always like that, at least I see it in 6.3 and it's only related to the cluster manager that doesn't handle failures of the base path proxy, e.g. if I run node scripts/kibana --dev --server.port=9200 on 6.3 with ES already listening on 9200, I get:

$ node scripts/kibana --dev --server.port=9200
(node:29250) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
 watching for changes  (1502 files)
(node:29250) UnhandledPromiseRejectionWarning: Error: listen EADDRINUSE 127.0.0.1:9200
    at Object._errnoException (util.js:992:11)
    at _exceptionWithHostPort (util.js:1014:20)
    at Server.setupListenHandle [as _listen2] (net.js:1355:14)
    at listenInCluster (net.js:1396:12)
    at GetAddrInfoReqWrap.doListen (net.js:1505:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)
(node:29250) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:29250) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:29274) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
(node:29279) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.

You should see a much clearer message if Kibana main server fails because of the same reason either on 6.3/6.4/master or in this PR. Having said that we can eventually properly handle errors that are coming from the main cluster master process if we want to.

Copy link
Copy Markdown
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

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

LGTM

@elasticmachine

This comment has been minimized.

@azasypkin
Copy link
Copy Markdown
Contributor Author

There is some flakiness in tests that I've touched (worker tests and new tutorial mixins), will figure that out. For the latter it's likely that Kibana server initialization takes more than 5 sec (I see locally it takes ~2.8-3.4s, with 95% of times spent on the LegacyService and await kbnServer.ready() in particular).

@elasticmachine

This comment has been minimized.

@azasypkin
Copy link
Copy Markdown
Contributor Author

Okay, in this particular case there is no reason to use full blown kibana server to test tutorial mixins so I modified the test to test mixin directly, should become green now.

But nevertheless I tried to figure out where kbn.ready spends most of the time and here are some not statistically significant results from a couple of my local test runs:

From a total of ~4.5s of Kibana server initialization ~1.77s were spent in sassMixin, ~1.2s in uiMixin and ~1.17s in uiRenderMixin. There is nothing to reason about here at this point, but now I have an idea where the problem can be.

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@azasypkin azasypkin merged commit 3d6de7c into elastic:master Sep 6, 2018
@azasypkin azasypkin deleted the issue-xxx-core-legacy-service branch September 6, 2018 15:39
@epixa epixa mentioned this pull request Sep 6, 2018
@azasypkin
Copy link
Copy Markdown
Contributor Author

6.x/6.5: b076716

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

Labels

backported Feature:New Platform Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// v6.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants