GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — uvloop strictly needs SO_REUSEPORT · Issue #550 · MagicStack/uvloop

uvloop strictly needs SO_REUSEPORT #550

New issue
Copy link
New issue
Copy link
Closed
#609
Closed
uvloop strictly needs SO_REUSEPORT#550
#609
Copy link

Description

@mtelka
mtelka
opened on Jul 19, 2023
Issue body actions

uvloop expects that SO_REUSEPORT is supported everywhere. Unfortunately, there are some platforms where SO_REUSEPORT is not supported. For example illumos.

Error message:

uvloop/loop.c: In function '__pyx_gb_6uvloop_4loop_4Loop_57generator3':
uvloop/loop.c:33764:46: error: 'SO_REUSEPORT' undeclared (first use in this function); did you mean 'SO_REUSEADDR'?
33764 |             __pyx_t_5 = __Pyx_PyInt_From_int(SO_REUSEPORT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1778, __pyx_L32_error)
      |                                              ^~~~~~~~~~~~
      |                                              SO_REUSEADDR
uvloop/loop.c:33764:46: note: each undeclared identifier is reported only once for each function it appears in
  • uvloop version: 0.17.0
  • Python version: 3.9.16
  • Platform: OpenIndiana/illumos
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: N/A
  • Does uvloop behave differently from vanilla asyncio? How?: N/A

Could you please detect the SO_REUSEPORT support during build and do not try to use SO_REUSEPORT if it is not available?

Thank you.

Activity

  1. cmchittom commented on May 27, 2024

    @cmchittom
    cmchittom
    on May 27, 2024
    More actions

    This appears to still be an issue:

    uvloop version: 0.19.0
    Python version: 3.12.3
    Platform: illumos (OmniOS r151050)

  2. ptribble commented on Jun 19, 2024

    @ptribble
    ptribble
    on Jun 19, 2024
    Contributor
    More actions

    The code correctly detects whether SO_REUSEPORT is available (look for has_SO_REUSEPORT).

    Unfortunately, at about line 1778 of uvloop/loop.pyx this code, which is where it's failing:

                        if reuse_port:
                            sock.setsockopt(uv.SOL_SOCKET, uv.SO_REUSEPORT, 1)
    

    is incorrect. The use of uv.SO_REUSEPORT brings in the C version of SO_REUSEPORT which doesn't exist, rather than the python version which does. So the code here should be

                        if reuse_port:
                            sock.setsockopt(uv.SOL_SOCKET, SO_REUSEPORT, 1)
    

    A quick test confirms that, with this change, a build on illumos is successful.

    Reacted by Marcel Telka
  3. mtelka commented on Jun 19, 2024

    @mtelka
    mtelka
    on Jun 19, 2024
    Author
    More actions

    @ptribble would you mind to create a PR to fix the issue? Thanks.

  4. ptribble
    added a commit that references this issue on Jun 20, 2024

    Use cythonized SO_REUSEPORT rather than the unwrapped native one.

    This issue will close once commit 48d0b1e is merged into the 'master' branch.
    48d0b1e
  5. fantix
    closed this as completedin #609on Aug 16, 2024
  6. fantix
    closed this as completedin 4083a94on Aug 16, 2024
  7. sthagen
    added a commit that references this issue on Aug 16, 2024

    Use cythonized SO_REUSEPORT rather than the unwrapped native one. (Ma…

    This issue will close once commit 4083a94 is merged into the 'master' branch.
    4083a94
  8. fantix
    added a commit that references this issue on Oct 14, 2024

    uvloop 0.21.0

    40e8a34
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.