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

Conversation

Projects
None yet
5 participants
@cjihrig
Contributor

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

@mcollina

LGTM

assert.strictEqual(sendFailures, 3);
});
socket.on('error', (err) => {

This comment has been minimized.

@jasnell

jasnell Jan 27, 2017

Member

common.mustCall()?

@jasnell

jasnell Jan 27, 2017

Member

common.mustCall()?

This comment has been minimized.

@cjihrig

cjihrig Jan 27, 2017

Contributor

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

@cjihrig

cjihrig Jan 27, 2017

Contributor

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

Show outdated Hide outdated test/parallel/test-dgram-implicit-bind-failure.js
// should also be two listeners - this function and the dgram internal one
// time error handler.
dnsFailures++;
assert.strictEqual(Array.isArray(socket._queue), true);

This comment has been minimized.

@thefourtheye

thefourtheye Jan 28, 2017

Contributor

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

@thefourtheye

thefourtheye Jan 28, 2017

Contributor

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

@cjihrig

This comment has been minimized.

Show comment
Hide comment
dns: handle implicit bind DNS errors
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: #10902
PR-URL: #11036
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

@cjihrig cjihrig merged commit 5587ff1 into nodejs:master Jan 30, 2017

@cjihrig cjihrig deleted the cjihrig:dgram-2 branch Jan 30, 2017

@thefourtheye

This comment has been minimized.

Show comment
Hide comment
@thefourtheye

thefourtheye Jan 30, 2017

Contributor

Belated LGTM.

Contributor

thefourtheye commented Jan 30, 2017

Belated LGTM.

@jasnell jasnell referenced this pull request Apr 4, 2017

Closed

8.0.0 Release Proposal #12220

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