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

fix(NA): apply ipv4 first dns result order for worker threads #163484

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/setup_node_env/dns_ipv4_first.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

// enables Node 16 default DNS lookup behavior for the current thread
require('dns').setDefaultResultOrder('ipv4first');

// overrides current process node options, so it can be restored in worker threads too
process.env.NODE_OPTIONS = `${process.env.NODE_OPTIONS || ''} --dns-result-order=ipv4first`;
2 changes: 1 addition & 1 deletion src/setup_node_env/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
require('./setup_env');

// restore < Node 16 default DNS lookup behavior
require('dns').setDefaultResultOrder('ipv4first');
require('./dns_ipv4_first');

require('@kbn/babel-register').install();
require('./polyfill');