dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.35k stars 9.99k forks source link

Listen on all sockets provided by systemd socket activation #24067

Closed onyxmaster closed 3 years ago

onyxmaster commented 4 years ago

Is your feature request related to a problem? Please describe.

Currently, when using systemd activation, the ASP.NET Core only listens on the first passed socket (SD_LISTEN_FDS_START, equal to 3). This prevents using multiple listening sockets in systemd socket definition. systemd passes the number of file descriptors via %LISTEN_FDS%, but currently the code doesn't take this into account.

Describe the solution you'd like

The issue is quite easy to fix, in fact I hacked a simple inline solution to this issue, but I believe that it should be improved at the source. I'm willing to provide a PR along the lines of the solution described above, but first I would like to know if there is any interest in this.

I understand that a backport to 2.1/3.1 is quite unlikely, but I have to ask if it is possible (given that the changes are probably going to be very localized and we're stuck on 2.1/3.1 for the near future). If backport is not possible, I would also like to ask if us providing a nuget package with "improved" version of UseSystemd is OK.

Since I did some previous work on related functionality, tagging @halter73 because he helped me last time with review and integration.

ghost commented 4 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

halter73 commented 4 years ago

@onyxmaster Thanks for finding this! We backlogged this for work in a future release, but I'd be happy to take a PR sooner. The logic in the "simple inline solution" does look like what we want in KestrelServerOptionsSystemdExtensions.

davidfowl commented 4 years ago

We don’t backport but a PR for this feature seems fine as long as it’s something natively supported by systemd. You should keep shopping that package to work out any oddities that may result from this feature