Directly constructed `uvloop.loop.Server(None)` segfaults in `close()`
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- python
- Domain
- backend, networking
Research direction
Start with the Server.close and Server._unref paths identified in uvloop/loop.c, then reproduce the failure with the Python snippet using Server(None). Trace the close path under ASan and verify that the reproducer raises a Python exception or otherwise completes without terminating the interpreter.
Written by the indexing model from the issue text.
Description
Summary
uvloop.loop.Server(None) constructs an object, but calling close() on it terminates the interpreter.
I found this while fuzzing Python C extension modules.
I realize this is not a realistic input or usage pattern, but I would expect a Python exception rather than a process crash.
Versions
uvloop 0.22.1, CPython 3.12.3, Debian 12 x86_64, glibc 2.36
Reproducer
from uvloop.loop import Server
server = Server(None)
server.close()
Segmentation fault (core dumped)
ASan/UBSan result
I built uvloop 0.22.1 from source with Clang 18 using ASan and UBSan instrumentation.
ASan reports a read from address 0x158 on the Server.close() path:
AddressSanitizer:DEADLYSIGNAL
ERROR: AddressSanitizer: SEGV on unknown address 0x000000000158
The signal is caused by a READ memory access.
Hint: address points to the zero page.
#0 PyType_IsSubtype
#1 CPython set operation
#2 __Pyx_PySet_Discard uvloop/loop.c:194862:17
#3 Server._unref uvloop/loop.c:160673:15
#4 Server.close uvloop/loop.c:161676:19
SUMMARY: AddressSanitizer: SEGV in PyType_IsSubtype
The sanitizer process exits with code 134 after ASan aborts.
UBSan did not emit a separate diagnostic before the ASan failure.
- Dominant language
- Cython
- Stars
- 11.9k
- Forks
- 615
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MagicStack/uvloop
-
License not clear Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
MagicStack/uvloop#759 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
MagicStack/uvloop#741 · 2 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
MagicStack/uvloop#702 · 8 comments · 9 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
MagicStack/uvloop#763 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
MagicStack/uvloop#754 · 1 comment · 1 reaction ·
All issues in MagicStack/uvloop
Similar issues
-
area/sessions comp/cron comp/gateway P2 sweeper:risk-message-delivery sweeper:risk-session-state type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NousResearch/hermes-agent#118863 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
use-agent-os/agent-os#3312 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
needs-acceptance wg/data-plane-networking
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vllm-project/semantic-router#4024 · 1 comment ·