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

cluster: fix closing dgram sockets in cluster workers throws errors #43709

Merged
merged 1 commit into from
Jul 11, 2022

Conversation

oyyd
Copy link
Contributor

@oyyd oyyd commented Jul 7, 2022

This fixes closing dgram sockets right after binding in cluster workers
will throws ERR_SOCKET_DGRAM_NOT_RUNNING errors.

Before this, the code snippet below will throw:

const dgram = require('dgram')
const cluster = require('cluster')

if (cluster.isMaster || cluster.isPrimary) {
  cluster.fork()
} else {
  const socket = dgram.createSocket('udp4');
  socket.bind(0, () => {
    socket.close();
  });
}

While running in primary processes won't throw:

const dgram = require('dgram')

const socket = dgram.createSocket('udp4');
socket.bind(0, () => {
  socket.close();
});

Fixes: #40671

@nodejs-github-bot nodejs-github-bot added cluster Issues and PRs related to the cluster subsystem. needs-ci PRs that need a full CI run. labels Jul 7, 2022
@oyyd oyyd force-pushed the cluster-dgram branch from 7e11943 to 2c12374 Compare July 7, 2022 10:14
@oyyd oyyd changed the title dgram: fix closing dgram sockets in cluster workers throws errors cluster: fix closing dgram sockets in cluster workers throws errors Jul 7, 2022
@oyyd oyyd force-pushed the cluster-dgram branch from 2c12374 to 1e02f40 Compare July 7, 2022 10:27
@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jul 7, 2022
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 7, 2022
@aduh95 aduh95 added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 7, 2022
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 7, 2022
@nodejs-github-bot
Copy link
Collaborator

@oyyd oyyd added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 8, 2022
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 8, 2022
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@aduh95
Copy link
Contributor

aduh95 commented Jul 9, 2022

/cc @nodejs/dgram

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

@aduh95 aduh95 added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Jul 11, 2022
This fixes closing dgram sockets right after binding in cluster
workers will throws `ERR_SOCKET_DGRAM_NOT_RUNNING` errors.
@oyyd
Copy link
Contributor Author

oyyd commented Jul 11, 2022

Sorry I just squashed the commits..

@aduh95 aduh95 removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 11, 2022
@aduh95
Copy link
Contributor

aduh95 commented Jul 11, 2022

Sorry I just squashed the commits..

Why? Now we have to re-run the CI..

@nodejs-github-bot
Copy link
Collaborator

@oyyd
Copy link
Contributor Author

oyyd commented Jul 11, 2022

Why? Now we have to re-run the CI..

It's unnecessary, my bad.

@mcollina
Copy link
Member

It's unnecessary, my bad.

It is, according to our process. No worries, I kicked it off.

@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 11, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 11, 2022
@nodejs-github-bot nodejs-github-bot merged commit 57d6228 into nodejs:main Jul 11, 2022
@nodejs-github-bot
Copy link
Collaborator

Landed in 57d6228

targos pushed a commit that referenced this pull request Jul 12, 2022
This fixes closing dgram sockets right after binding in cluster
workers will throws `ERR_SOCKET_DGRAM_NOT_RUNNING` errors.

PR-URL: #43709
Fixes: #40671
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
targos pushed a commit that referenced this pull request Jul 20, 2022
This fixes closing dgram sockets right after binding in cluster
workers will throws `ERR_SOCKET_DGRAM_NOT_RUNNING` errors.

PR-URL: #43709
Fixes: #40671
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
targos pushed a commit that referenced this pull request Jul 31, 2022
This fixes closing dgram sockets right after binding in cluster
workers will throws `ERR_SOCKET_DGRAM_NOT_RUNNING` errors.

PR-URL: #43709
Fixes: #40671
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
guangwong pushed a commit to noslate-project/node that referenced this pull request Oct 10, 2022
This fixes closing dgram sockets right after binding in cluster
workers will throws `ERR_SOCKET_DGRAM_NOT_RUNNING` errors.

PR-URL: nodejs/node#43709
Fixes: nodejs/node#40671
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. cluster Issues and PRs related to the cluster subsystem. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v17.0.1 & v16.13.0 udp dgram health check bug in cluster model
5 participants