Skip to content

Commit

Permalink
fix(connect): connect with family 0 instead of family 4
Browse files Browse the repository at this point in the history
This is a fix for a hard-to-reproduce bug that occurs in
certain network setups on Windows 10. In  those cases,
attempting an IPv6 lookup with a shortname will somehow cause the
subsequent IPv4 lookup to also fail, even though it can succeed
independently. For some reason, this does NOT happen with family: 0.

This really should be fixed in either Node or in Windows itself,
but since we cannot create a stable reproducer, we will use this
fix short-term while we come up with a more stable solution.

Fixes NODE-1747
Fixes NODE-2143
  • Loading branch information
daprahamian committed Nov 19, 2019
1 parent ea83360 commit db07366
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/core/connection/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function connect(options, callback) {

return makeConnection(6, options, (err, ipv6Socket) => {
if (err) {
makeConnection(4, options, (err, ipv4Socket) => {
makeConnection(0, options, (err, ipv4Socket) => {

This comment has been minimized.

Copy link
@ephemer

ephemer Dec 11, 2019

Contributor

is it possible this could break connections on CentOS? half of our servers were offline for hours this afternoon and this is the only thing I can find that might have caused it

if (err) {
callback(err, ipv4Socket); // in the error case, `ipv4Socket` is the originating error event name
return;
Expand Down

0 comments on commit db07366

Please sign in to comment.