Skip to content

Support needed for AF_RDS family #52025

Closed

Description

@AndrewGrover
BPO 7777
Nosy @loewis, @pitrou, @vstinner, @briancurtin
Files
  • socket_rds.diff
  • socket_rds-1.diff
  • socket_rds-2.diff
  • 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 2011-11-10.21:42:49.432>
    created_at = <Date 2010-01-25.07:27:38.170>
    labels = ['extension-modules', 'type-feature']
    title = 'Support needed for AF_RDS family'
    updated_at = <Date 2011-11-10.21:42:49.432>
    user = 'https://bugs.python.org/AndrewGrover'

    bugs.python.org fields:

    activity = <Date 2011-11-10.21:42:49.432>
    actor = 'neologix'
    assignee = 'none'
    closed = True
    closed_date = <Date 2011-11-10.21:42:49.432>
    closer = 'neologix'
    components = ['Extension Modules']
    creation = <Date 2010-01-25.07:27:38.170>
    creator = 'Andrew.Grover'
    dependencies = []
    files = ['23583', '23588', '23617']
    hgrepos = []
    issue_num = 7777
    keywords = ['patch', 'needs review']
    message_count = 11.0
    messages = ['98271', '98272', '146802', '146805', '146813', '147077', '147084', '147146', '147161', '147185', '147408']
    nosy_count = 7.0
    nosy_names = ['loewis', 'pitrou', 'vstinner', 'brian.curtin', 'Andrew.Grover', 'neologix', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue7777'
    versions = ['Python 3.3']

    Activity

    1. AndrewGrover commented on Jan 25, 2010

      AndrewGrovermannequin
      MannequinAuthor

      RDS is a reliable datagram protocol used by Oracle clusters for inter-process communication. It is in the Linux kernel, and has a defined address family number. Its use is identical to UDP, except the address family is 21, and the type is SOCK_SEQPACKET.

      So, what's this got to do with Python? :)

      Apparently Modules/socketmodule.c getsockaddrarg() checks bind() args, and only allows known socket types to bind. Attempting to bind with an RDS socket fails.

      It looks pretty straightforward to add support for a new family, but before doing so I wanted to check whether this was likely to be accepted, and also to ask if it wouldn't make more sense for getsockaddrarg() to not default to failing unknown families, but instead letting them through? If the params are wrong for a non-enumerated family, bind() will presumably return an error that the user will get.

    2. loewis commented on Jan 25, 2010

      loewismannequin
      Mannequin

      A patch has good chances of getting accepted (eventually; it may take several months or years). Test cases and documentation changes should be included.

      Supporting generic socket addresses can't work (IMO): how could Python possibly know how to map a Python representation of the address (which is likely a tuple of some kind) onto a struct sockaddr?

    3. neologix commented on Nov 1, 2011

      neologixmannequin
      Mannequin

      Here's a patch adding support for RDS sockets (with test and documentation update).

    4. pitrou commented on Nov 1, 2011

      @pitrou
      Member

      A couple of things:

      • the tests are skipped with "unable to bind RDS socket" here (even under root). Is it expected?
      • socket.error is the same as OSError now
      • there are some ResourceWarnings abount unclosed sockets when running the tests
    5. neologix commented on Nov 1, 2011

      neologixmannequin
      Mannequin
      • the tests are skipped with "unable to bind RDS socket" here (even
        under root). Is it expected?

      Oops. I did a quick test to force the socket family (because RDS sockets really use sockaddr_in), and apparently I overwrote my original patch... Here's the correct one.
      As long as the rds module is loaded, all the tests should pass.

      • socket.error is the same as OSError now

      I changed this in this patch.
      I'll update the other occurrences in test_socket in a separate patch.

      • there are some ResourceWarnings abount unclosed sockets when
        running the tests

      Same thing here, I fixed those in my original patch, then somehow overwrote it with a previous version...

    6. neologix commented on Nov 5, 2011

      neologixmannequin
      Mannequin

      So, what do you think of the new patch?

    7. pitrou commented on Nov 5, 2011

      @pitrou
      Member

      Oops, sorry. I wonder if it would be possible to test the address returned by recvfrom(). Same for the flags and ancillary data in recvmsg().

    8. loewis commented on Nov 6, 2011

      loewismannequin
      Mannequin

      I think the patch currently lacks a lot of symbolic constants; see my review.

    9. neologix commented on Nov 6, 2011

      neologixmannequin
      Mannequin

      Here's an updated patch:

      • address returned by recvfrom()
      • recv flags (MSG_PEEK)
      • congestion behavior

      I've also added a bunch of constants:

      • all the typical SO_ constants
      • CMSG flags
      • RDMA-related options (RDMA is probably one of the most useful features of RDS)
      • I chose to let aside INFO flags, since they don't appear in the man pages (and neither here: https://github.com/agrover/python-rds/blob/master/rdma.py, a ctypes-based RDS implementation I stumbled upon)
      • I didn't add control messages tests: they all pertain to RDMA, which is rather tricky to test to test from Python (and my header files don't define them)
    10. loewis commented on Nov 6, 2011

      loewismannequin
      Mannequin

      Not having tests for the control messages is fine with me - we don't need to test Linux, but Python.

    11. python-dev commented on Nov 10, 2011

      python-devmannequin
      Mannequin

      New changeset 2293ca739223 by Charles-François Natali in branch 'default':
      Issue bpo-7777: socket: Add Reliable Datagram Sockets (PF_RDS) support.
      http://hg.python.org/cpython/rev/2293ca739223

    12. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions