dotnet / dotnet/aspnetcore

Kestrel should set O_CLOEXEC flag when listening on socket passed in via file descriptor

Open
#30,079 2 comments 0 reactions 0 assignees View on GitHub
area-networking feature-kestrel
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

Kestrel should set `O_CLOEXEC` flag on socket when listening on socket passed in via file descriptor (e.g., systemd activation). We're currently leaking these file descriptor to child processes.

There is currently no managed API that wraps [`fcntl()`](https://man7.org/linux/man-pages/man2/fcntl.2.html), so we may have to P/Invoke in Kestrel to achieve this behavior.

Related: https://github.com/dotnet/runtime/issues/46832

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.