You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
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.
Activity
cmchittom commentedon May 27, 2024
This appears to still be an issue:
uvloop version: 0.19.0
Python version: 3.12.3
Platform: illumos (OmniOS r151050)
ptribble commentedon Jun 19, 2024
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:
is incorrect. The use of
uv.SO_REUSEPORTbrings in the C version ofSO_REUSEPORTwhich doesn't exist, rather than the python version which does. So the code here should beA quick test confirms that, with this change, a build on illumos is successful.
mtelka commentedon Jun 19, 2024
@ptribble would you mind to create a PR to fix the issue? Thanks.
Use cythonized SO_REUSEPORT rather than the unwrapped native one.
Use cythonized SO_REUSEPORT rather than the unwrapped native one. (Ma…
uvloop 0.21.0