Skip to content

test: verify the number of fds on start#3490

Closed
vtjnash wants to merge 1 commit intolibuv:v1.xfrom
vtjnash:jn/test-spawn-nfds
Closed

test: verify the number of fds on start#3490
vtjnash wants to merge 1 commit intolibuv:v1.xfrom
vtjnash:jn/test-spawn-nfds

Conversation

@vtjnash
Copy link
Copy Markdown
Member

@vtjnash vtjnash commented Feb 23, 2022

Helps ensure that we do not accidentally leak an fd unintentionally
during uv_spawn.

Helps ensure that we do not accidentally leak an fd unintentionally
during uv_spawn.
Comment on lines +78 to +86
if ((argc == 2 || argc == 4) && strcmp(argv[1], "spawn_helper5") == 0) {
uv__check_nfd(4);
} else if ((argc == 2 || argc == 4) && strcmp(argv[1], "spawn_tcp_server_helper") == 0) {
uv__check_nfd(4);
} else if ((argc == 2 || argc == 4) && strcmp(argv[1], "spawn_helper8") == 0) {
/* skip */
} else {
uv__check_nfd(3);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Style: long lines.

Substance: might be problematic when trying to debug in gdb, it spawns the process with (three?) extra file descriptors.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I haven't seen any issues with gdb or lldb locally, but I will note that the GitHub Actions CI system test harness does appear have a number of problems with excess file descriptors, so it might be bad to merge this for that reason.

return errno;

return 0;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tangential: this is uv__cloexec_fcntl() from src/unix/core.c, right? We could simplify that to just a F_SETFD call because FD_CLOEXEC is the only defined flag anyway.

@stale
Copy link
Copy Markdown

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale label Apr 16, 2022
@vtjnash vtjnash closed this Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants