Skip to content

Conversation

@onyxmaster
Copy link
Contributor

Implements support for multiple sockets when using systemd socket activation by taking into account the %LISTEN_FDS%. Attempts to preserve backward feature compatibility, falling back to default number of sockets to be 1.

Addresses #24067

@ghost ghost added the area-servers label Jul 20, 2020
@onyxmaster onyxmaster force-pushed the multiple-fds-for-systemd branch from ac675dd to 4933094 Compare July 20, 2020 17:50
Copy link
Member

@halter73 halter73 Jul 20, 2020

Choose a reason for hiding this comment

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

byte. Is it documented anywhere that LISTEN_FDS cannot be larger than 127?

Copy link
Contributor Author

@onyxmaster onyxmaster Jul 20, 2020

Choose a reason for hiding this comment

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

No, this is actually allowed to be in range of [1;INT_MAX-3], but I thought it might be a good idea to limit it to a more reasonable number since I don't really believe that supporting inheritance of INT_MAX-4 sockets is a practical idea because I don't think it would be robust and/or testable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Still, matching systemd's "native" functionality is not an issue to me, if you believe this is a correct way of handling this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also opted out of hard failure when invalid values for %LISTEN_FDS% (like 0 or -84) are presented, not sure if this is a proper course of action, since systemd "native" library is very explicit about invalid values (considers this an error) and missing envvar (treats this as a non-socket-activated case).

Copy link
Member

Choose a reason for hiding this comment

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

Sorry for the slow reply, I think we should change this to an int. If LISTEN_FDS is really large, so be it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problems, Stephen, had a lot on my plate recently too. I'll match sd_listen_fds behavior then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I fixed this, also rebased to more recent head.

@onyxmaster
Copy link
Contributor Author

It occured to me that the basic testing framework based on a docker container appears to be dead now, killed when Travis was removed and it wasn't picked up by the new CI pipeline.
This complicates things because it prevents regression testing. I don't believe I'm acquainted enough with the current build system (Azure pipelines) to fix the test-related issue in a reasonable amount of time.

@halter73
Copy link
Member

@onyxmaster You're correct to point out that we no longer have regression testing for the logic in UseSystemd since we stopped running tests on Travis. We do have a test for socket handles in general, but that's not affected by this change.

You don't need to take responsibility for adding regression tests where there currently are none (thought that would certainly be welcome). For now, manual verification should sufficient.

@onyxmaster
Copy link
Contributor Author

Thanks. I would really like to provide a test, and I think that taking a look at Azure Pipelines would be interesting, but I really don't have time for this right now 😔

@onyxmaster onyxmaster force-pushed the multiple-fds-for-systemd branch from 60dd800 to 435e1e5 Compare July 31, 2020 05:56
@onyxmaster onyxmaster force-pushed the multiple-fds-for-systemd branch from 435e1e5 to bddc440 Compare July 31, 2020 05:57
@onyxmaster onyxmaster force-pushed the multiple-fds-for-systemd branch from bddc440 to 457118e Compare July 31, 2020 05:58
@onyxmaster onyxmaster marked this pull request as ready for review August 6, 2020 05:20
@captainsafia captainsafia added the community-contribution Indicates that the PR has been added by a community member label Aug 14, 2020
@onyxmaster
Copy link
Contributor Author

It does look like CI failures are unrelated to introduced changes. Would you please take a look?

@halter73 halter73 merged commit 2ca239d into dotnet:master Aug 18, 2020
@halter73
Copy link
Member

Thanks @onyxmaster!

@onyxmaster onyxmaster deleted the multiple-fds-for-systemd branch August 19, 2020 07:17
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants