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

dgram: check udp buffer size to avoid fd leak #56084

Merged

Conversation

theanarkh
Copy link
Contributor

const udp = require('dgram');

// uncaughtException event is triggered
process.on('uncaughtException', () => {});

for (let i = 0; i < 10; i++) {
    const socket = udp.createSocket({type: 'udp4', recvBufferSize: 'x'});
    // error and listening events are not triggered
    socket.on('error', () => {
        socket.close();
    });
    socket.on('listening', () => {
        socket.close();
    });
    socket.bind(0);
}

The process will open 10 fds.

  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added dgram Issues and PRs related to the dgram subsystem / UDP. needs-ci PRs that need a full CI run. labels Nov 29, 2024
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

@theanarkh theanarkh force-pushed the check_buffer_size_to_avoid_fd_leak branch from 98bc860 to 37fbf6d Compare November 29, 2024 19:44
Copy link

codecov bot commented Nov 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.00%. Comparing base (4cf6fab) to head (37fbf6d).
Report is 14 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #56084   +/-   ##
=======================================
  Coverage   88.00%   88.00%           
=======================================
  Files         656      656           
  Lines      188988   188995    +7     
  Branches    35992    35996    +4     
=======================================
+ Hits       166315   166325   +10     
+ Misses      15838    15836    -2     
+ Partials     6835     6834    -1     
Files with missing lines Coverage Δ
lib/dgram.js 97.35% <100.00%> (+0.01%) ⬆️

... and 28 files with indirect coverage changes

@theanarkh theanarkh added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 30, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 30, 2024
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@theanarkh theanarkh added the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 2, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 2, 2024
@nodejs-github-bot nodejs-github-bot merged commit 61e4ad5 into nodejs:main Dec 2, 2024
59 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 61e4ad5

targos pushed a commit that referenced this pull request Dec 2, 2024
PR-URL: #56084
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
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. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants