Skip to content

Add socket.SO_REUSEPORT_LB and use it in socket.create_server(reuse_port=True) and BaseEventLoop.create_server(reuse_port=True) #124761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
graingert opened this issue Sep 29, 2024 · 3 comments
Labels
extension-modules C modules in the Modules dir stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@graingert
Copy link
Contributor

graingert commented Sep 29, 2024

Feature or enhancement

Proposal:

SO_REUSEPORT_LB is defined in freebsd: https://man.freebsd.org/cgi/man.cgi?setsockopt(2)

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

@graingert graingert added the type-feature A feature request or enhancement label Sep 29, 2024
@graingert
Copy link
Contributor Author

graingert commented Sep 29, 2024

On some platforms eg Darwin/freebsd socket.create_server(reuse_port=True) doesn't actually allow the port to be reused: only one socket that refuses the port can actually receive traffic. I'd like to be able to indicate my need for load balancing behaviour and get an exception on platforms where it's unavailable

graingert added a commit to graingert/cpython that referenced this issue Oct 4, 2024
@graingert graingert changed the title Add socket.SO_REUSEPORT_LB and use it in socket.create_server(reuse_port=True) Add socket.SO_REUSEPORT_LB and use it in socket.create_server(reuse_port=True) and BaseEventLoop.create_server Oct 4, 2024
@graingert graingert changed the title Add socket.SO_REUSEPORT_LB and use it in socket.create_server(reuse_port=True) and BaseEventLoop.create_server Add socket.SO_REUSEPORT_LB and use it in socket.create_server(reuse_port=True) and BaseEventLoop.create_server(reuse_port=True) Oct 4, 2024
@picnixz picnixz added extension-modules C modules in the Modules dir stdlib Python modules in the Lib dir labels Oct 14, 2024
@graingert
Copy link
Contributor Author

This needs support in create_server before closing

@graingert graingert reopened this Dec 26, 2024
@kumaraditya303
Copy link
Contributor

Ah, sorry I missed that.

srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this issue Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants