Skip to content
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

SocketServer should set SO_REUSEPORT along with SO_REUSEADDR when present #60798

Closed
AndyZeldis mannequin opened this issue Dec 2, 2012 · 3 comments
Closed

SocketServer should set SO_REUSEPORT along with SO_REUSEADDR when present #60798

AndyZeldis mannequin opened this issue Dec 2, 2012 · 3 comments
Labels
3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@AndyZeldis
Copy link
Mannequin

AndyZeldis mannequin commented Dec 2, 2012

BPO 16594
Nosy @gvanrossum, @asvetlov, @aisk
PRs
  • bpo-16594: Add allow_reuse_port on socketserver #30072
  • Files
  • osc-broadcast-rcv.py: SocketServer broadcast receive workaround
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-12-13.13:33:49.165>
    created_at = <Date 2012-12-02.09:07:29.427>
    labels = ['type-bug', 'library', '3.11']
    title = 'SocketServer should set SO_REUSEPORT along with SO_REUSEADDR when present'
    updated_at = <Date 2021-12-13.13:33:49.164>
    user = 'https://bugs.python.org/AndyZeldis'

    bugs.python.org fields:

    activity = <Date 2021-12-13.13:33:49.164>
    actor = 'asvetlov'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-12-13.13:33:49.165>
    closer = 'asvetlov'
    components = ['Library (Lib)']
    creation = <Date 2012-12-02.09:07:29.427>
    creator = 'Andy.Zeldis'
    dependencies = []
    files = ['28183']
    hgrepos = []
    issue_num = 16594
    keywords = ['patch']
    message_count = 3.0
    messages = ['176777', '205125', '408447']
    nosy_count = 4.0
    nosy_names = ['gvanrossum', 'asvetlov', 'Andy.Zeldis', 'asaka']
    pr_nums = ['30072']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue16594'
    versions = ['Python 3.11']

    @AndyZeldis
    Copy link
    Mannequin Author

    AndyZeldis mannequin commented Dec 2, 2012

    On BSD (including Mac OS X) SO_REUSEPORT should be specified along with SO_REUSEADDR to match behavior on Linux (and possible Windows). This is needed to have multiple listeners to a UDP broadcast.

    I discovered this when using PyOSC. Attached is an example modified to subclass SocketServer with a workaround. It should be possible to start multiple instances of this program, all of which will receive messages to a broadcast address (eg 255.255.255.255:7110).

    This test uses Python 2.7 on OS X (despite the "python3" shebang line from the example)

    @AndyZeldis AndyZeldis mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Dec 2, 2012
    @gvanrossum
    Copy link
    Member

    Note: it is possible that SO_REUSEPORT is defined yet not implemented (and you'll get an OSError when using it).

    @asvetlov
    Copy link
    Contributor

    New changeset b56774b by AN Long in branch 'main':
    bpo-16594: Add allow_reuse_port on socketserver (GH-30072)
    b56774b

    @asvetlov asvetlov added the 3.11 only security fixes label Dec 13, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants