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

configurable global socket timeouts #31603

Merged
merged 15 commits into from
Jul 3, 2019
Merged

Conversation

jbudz
Copy link
Member

@jbudz jbudz commented Feb 20, 2019

This introduces two new kibana.yml configurations:

server.socketTimeout: default 2 minutes, close sockets after this amount of inactivity
server.keepAliveTimeout: default 2 minutes, close keepalive sockets after this amount of inactivity

Closes #31549

@jbudz jbudz added review Team:Operations Team label for Operations Team labels Feb 20, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@jbudz jbudz added the non-issue Indicates to automation that a pull request should not appear in the release notes label Mar 27, 2019
@jbudz jbudz added v7.3.0 and removed v7.2.0 labels May 23, 2019
@jbudz jbudz requested a review from a team as a code owner May 29, 2019 06:53
@jbudz jbudz requested a review from a team May 29, 2019 06:57
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
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, but I've only looked at the code. Will take a stab at testing this tomorrow, and I think we should add some docs for this config values.

Copy link
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.

Okay, I have no idea how to test this. But the usage lines up with both the hapi and node http server docs, so I'm good with it.

@jbudz jbudz added release_note:enhancement and removed non-issue Indicates to automation that a pull request should not appear in the release notes labels Jun 24, 2019
server.listener.setTimeout(listenerOptions.socketTimeout);
server.listener.on('timeout', socket => {
if (socket.writable) {
socket.end(Buffer.from('HTTP/1.1 408 Request Timeout\r\n\r\n', 'ascii'));
Copy link
Contributor

Choose a reason for hiding this comment

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

adding a test for timeout shouldn't be a problem. in http_server.test.ts:

const delay = (ms: number) => new Promise(res => setTimeout(res, ms));
test('returns 408 on timeout error', async () => {
  const router = new Router('');

  router.get({ path: '/', validate: false }, async (req, res) => {
    await delay(1000);
    return res.ok({});
  });

  const { registerRouter, server: innerServer } = await server.setup({
    ...config,
    socketTimeout: 1,
  });
  registerRouter(router);

  await server.start();

  await supertest(innerServer.listener).get('/').expect(408)
});

Copy link
Member Author

Choose a reason for hiding this comment

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

added!

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💔 Build Failed

@jbudz
Copy link
Member Author

jbudz commented Jul 2, 2019

retest

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@spalger spalger added the v7.4.0 label Jul 3, 2019
@jbudz jbudz removed the v7.3.0 label Jul 3, 2019
@jbudz jbudz merged commit e08f92b into elastic:master Jul 3, 2019
jbudz added a commit that referenced this pull request Jul 3, 2019
* configurable global socket timeouts

* update snapshots

* update tests

* add test

* add test

* add test

* happy path

* test happy path

* docs

* stop server after
jbudz added a commit to jbudz/kibana that referenced this pull request Jul 11, 2019
* configurable global socket timeouts

* update snapshots

* update tests

* add test

* add test

* add test

* happy path

* test happy path

* docs

* stop server after
jbudz added a commit that referenced this pull request Jul 15, 2019
* configurable global socket timeouts

* update snapshots

* update tests

* add test

* add test

* add test

* happy path

* test happy path

* docs

* stop server after
jbudz added a commit that referenced this pull request Jul 15, 2019
* configurable global socket timeouts

* update snapshots

* update tests

* add test

* add test

* add test

* happy path

* test happy path

* docs

* stop server after
jbudz added a commit that referenced this pull request Jul 15, 2019
* configurable global socket timeouts (#31603)

* configurable global socket timeouts

* update snapshots

* update tests

* add test

* add test

* add test

* happy path

* test happy path

* docs

* stop server after

* fix/lint import ordering

* use older new platform apis

* prettier

* config => HttpConfig
peterschretlen pushed a commit to peterschretlen/kibana that referenced this pull request Jul 23, 2019
peterschretlen pushed a commit to peterschretlen/kibana that referenced this pull request Jul 23, 2019
peterschretlen pushed a commit to peterschretlen/kibana that referenced this pull request Jul 23, 2019
peterschretlen pushed a commit that referenced this pull request Jul 24, 2019
* revert - [tests] remove name from http server args (#41209)

* revert - configurable global socket timeouts (#31603)
@timroes
Copy link
Contributor

timroes commented Aug 12, 2019

@jbudz @peterschretlen it seems this has been reverted on 6.8 branch again. Is there plans to reintroduce this, otherwise I think we should remove the 6.8.2 label from this PR.

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

Successfully merging this pull request may close these issues.

Configurable global socket timeout
6 participants