Skip to content

Auto-port 4.1: Native transports: Fix possible fd leak when fcntl fails.#16446

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

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

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port of #16442 to 4.1
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 4.1.132.Final milestone Mar 12, 2026
@normanmaurer normanmaurer requested a review from chrisvest March 12, 2026 21:09
@normanmaurer normanmaurer merged commit 7df743f into 4.1 Mar 13, 2026
19 checks passed
@normanmaurer normanmaurer deleted the auto-port-pr-16442-to-4.1 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