Skip to content

Auto-port 5.0: Native transports: Fix possible fd leak when fcntl fails.#16447

Merged
normanmaurer merged 1 commit into
5.0from
auto-port-pr-16442-to-5.0
Mar 13, 2026
Merged

Auto-port 5.0: Native transports: Fix possible fd leak when fcntl fails.#16447
normanmaurer merged 1 commit into
5.0from
auto-port-pr-16442-to-5.0

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port of #16442 to 5.0
Cherry-picked commit: 9f2900f


Motivation:

When accept4(...) is not present on the platform we fallback to using normal accept(...) syscall. In this case we also need two extra syscalls (fcntl). If one of the fcntl calls failed we did not close the previous accepted fd and so leaked it.

Modifications:

Call close(...) before returning early

Result:

No more fd leak in case of fcntl failure

Motivation:

When accept4(...) is not present on the platform we fallback to using
normal accept(...) syscall. In this case we also need two extra syscalls
(fcntl). If one of the fcntl calls failed we did not close the previous
accepted fd and so leaked it.

Modifications:

Call close(...) before returning early

Result:

No more fd leak in case of fcntl failure

(cherry picked from commit 9f2900f)
@normanmaurer normanmaurer added this to the 5.0.0.Final milestone Mar 12, 2026
@normanmaurer normanmaurer merged commit 721f95d into 5.0 Mar 13, 2026
13 checks passed
@normanmaurer normanmaurer deleted the auto-port-pr-16442-to-5.0 branch March 13, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants