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

dns: handle implicit bind DNS errors #11036

Merged
merged 1 commit into from
Jan 30, 2017
Merged

dns: handle implicit bind DNS errors #11036

merged 1 commit into from
Jan 30, 2017

Conversation

cjihrig
Copy link
Contributor

@cjihrig cjihrig commented Jan 27, 2017

When send() triggers an implicit bind, the send operation is added to an internal queue. If a DNS error occurs during the bind, there is currently no mechanism for clearing the queue other than sending more data. If DNS errors keep occurring, the queue will continue to grow with no upper bound. This commit reports errors with implicit binds, and clears the queue. This should be fine,
given the nature of UDP.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

dgram

@nodejs-github-bot nodejs-github-bot added dgram Issues and PRs related to the dgram subsystem / UDP. lts-watch-v6.x labels Jan 27, 2017
@cjihrig cjihrig added the semver-major PRs that contain breaking changes and should be released in the next major version. label Jan 27, 2017
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

LGTM

assert.strictEqual(sendFailures, 3);
});

socket.on('error', (err) => {
Copy link
Member

Choose a reason for hiding this comment

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

common.mustCall()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need in this case, because two types of errors are counted and checked on process exit.

// should also be two listeners - this function and the dgram internal one
// time error handler.
dnsFailures++;
assert.strictEqual(Array.isArray(socket._queue), true);
Copy link
Contributor

Choose a reason for hiding this comment

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

This could have been simply assert(Array.isArray(socket._queue));

@cjihrig
Copy link
Contributor Author

cjihrig commented Jan 30, 2017

When send() triggers an implicit bind, the send operation is
added to an internal queue. If a DNS error occurs during the bind,
there is currently no mechanism for clearing the queue other than
sending more data. If DNS errors keep occurring, the queue will
continue to grow with no upper bound. This commit reports errors
with implicit binds, and clears the queue. This should be fine,
given the nature of UDP.

Refs: nodejs/node-v0.x-archive#8705
Refs: nodejs#10902
PR-URL: nodejs#11036
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@thefourtheye
Copy link
Contributor

Belated LGTM.

@jasnell jasnell mentioned this pull request Apr 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dgram Issues and PRs related to the dgram subsystem / UDP. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants