multiloop 0.1.1__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. {multiloop-0.1.1 → multiloop-0.1.3}/AGENTS.md +17 -48
  2. {multiloop-0.1.1 → multiloop-0.1.3}/CHANGELOG.md +40 -0
  3. {multiloop-0.1.1 → multiloop-0.1.3}/CITATION.cff +2 -2
  4. {multiloop-0.1.1 → multiloop-0.1.3}/CONTRIBUTING.md +0 -2
  5. {multiloop-0.1.1 → multiloop-0.1.3}/Cargo.lock +4 -190
  6. {multiloop-0.1.1 → multiloop-0.1.3}/Cargo.toml +3 -8
  7. {multiloop-0.1.1 → multiloop-0.1.3}/Makefile +1 -1
  8. {multiloop-0.1.1 → multiloop-0.1.3}/PKG-INFO +42 -126
  9. multiloop-0.1.3/README.md +271 -0
  10. multiloop-0.1.3/README_ZH.md +271 -0
  11. {multiloop-0.1.1 → multiloop-0.1.3}/docs/API.md +54 -70
  12. {multiloop-0.1.1 → multiloop-0.1.3}/docs/API_ZH.md +55 -71
  13. {multiloop-0.1.1 → multiloop-0.1.3}/docs/CHOOSING.md +0 -3
  14. {multiloop-0.1.1 → multiloop-0.1.3}/docs/CHOOSING_ZH.md +0 -3
  15. {multiloop-0.1.1 → multiloop-0.1.3}/docs/CONCURRENCY.md +14 -9
  16. {multiloop-0.1.1 → multiloop-0.1.3}/docs/CONCURRENCY_ZH.md +14 -7
  17. multiloop-0.1.3/examples/05_multicore_pipeline.py +76 -0
  18. {multiloop-0.1.1 → multiloop-0.1.3}/examples/README.md +1 -2
  19. {multiloop-0.1.1 → multiloop-0.1.3}/examples/README_ZH.md +1 -2
  20. {multiloop-0.1.1 → multiloop-0.1.3}/pyproject.toml +1 -9
  21. {multiloop-0.1.1 → multiloop-0.1.3}/src/channel.rs +261 -106
  22. {multiloop-0.1.1 → multiloop-0.1.3}/src/lib.rs +17 -53
  23. {multiloop-0.1.1 → multiloop-0.1.3}/src/metrics.rs +11 -0
  24. {multiloop-0.1.1 → multiloop-0.1.3}/src/multiloop/__init__.py +6 -8
  25. {multiloop-0.1.1 → multiloop-0.1.3}/src/multiloop/__init__.pyi +65 -91
  26. {multiloop-0.1.1 → multiloop-0.1.3}/src/multiloop/_cancel.py +11 -4
  27. multiloop-0.1.3/src/multiloop/_channel_base.py +80 -0
  28. {multiloop-0.1.1 → multiloop-0.1.3}/src/multiloop/_metrics.py +1 -0
  29. {multiloop-0.1.1 → multiloop-0.1.3}/src/multiloop/_multiloop_core.pyi +19 -0
  30. {multiloop-0.1.1 → multiloop-0.1.3}/src/multiloop/_sync.py +45 -0
  31. {multiloop-0.1.1 → multiloop-0.1.3}/src/multiloop/_taskgroup.py +238 -32
  32. {multiloop-0.1.1 → multiloop-0.1.3}/src/multiloop/context.py +37 -0
  33. {multiloop-0.1.1 → multiloop-0.1.3}/src/multiloop/exceptions.py +22 -2
  34. {multiloop-0.1.1 → multiloop-0.1.3}/src/multiloop/pool.py +109 -55
  35. {multiloop-0.1.1 → multiloop-0.1.3}/src/multiloop/primitives.py +271 -185
  36. {multiloop-0.1.1 → multiloop-0.1.3}/src/multiloop/rwlock.py +79 -44
  37. {multiloop-0.1.1 → multiloop-0.1.3}/src/pool.rs +26 -19
  38. {multiloop-0.1.1 → multiloop-0.1.3}/src/rwlock.rs +84 -7
  39. {multiloop-0.1.1 → multiloop-0.1.3}/tests/test_channel.py +109 -0
  40. {multiloop-0.1.1 → multiloop-0.1.3}/tests/test_pool.py +42 -0
  41. {multiloop-0.1.1 → multiloop-0.1.3}/tests/test_regression_bugs.py +86 -0
  42. {multiloop-0.1.1 → multiloop-0.1.3}/tests/test_sync_lock_event.py +24 -0
  43. {multiloop-0.1.1 → multiloop-0.1.3}/tests/test_sync_primitives.py +50 -6
  44. {multiloop-0.1.1 → multiloop-0.1.3}/tests/test_taskgroup.py +145 -0
  45. {multiloop-0.1.1 → multiloop-0.1.3}/uv.lock +1 -103
  46. multiloop-0.1.1/README.md +0 -355
  47. multiloop-0.1.1/README_ZH.md +0 -354
  48. multiloop-0.1.1/benchmarks/bench_asgi_throughput.py +0 -475
  49. multiloop-0.1.1/examples/05_asgi_websocket.py +0 -71
  50. multiloop-0.1.1/examples/06_wsgi_flask.py +0 -37
  51. multiloop-0.1.1/src/h2.rs +0 -359
  52. multiloop-0.1.1/src/http.rs +0 -135
  53. multiloop-0.1.1/src/multiloop/_channel_base.py +0 -338
  54. multiloop-0.1.1/src/multiloop/_http11.py +0 -707
  55. multiloop-0.1.1/src/multiloop/_lifespan.py +0 -174
  56. multiloop-0.1.1/src/multiloop/_websocket.py +0 -266
  57. multiloop-0.1.1/src/multiloop/asgi.py +0 -218
  58. multiloop-0.1.1/src/multiloop/cli.py +0 -275
  59. multiloop-0.1.1/src/multiloop/server.py +0 -336
  60. multiloop-0.1.1/src/multiloop/wsgi.py +0 -311
  61. multiloop-0.1.1/src/websocket.rs +0 -126
  62. multiloop-0.1.1/tests/test_asgi_lifespan_ws.py +0 -731
  63. multiloop-0.1.1/tests/test_cli.py +0 -46
  64. multiloop-0.1.1/tests/test_server.py +0 -444
  65. multiloop-0.1.1/tests/test_wsgi.py +0 -127
  66. {multiloop-0.1.1 → multiloop-0.1.3}/.editorconfig +0 -0
  67. {multiloop-0.1.1 → multiloop-0.1.3}/.github/FUNDING.yml +0 -0
  68. {multiloop-0.1.1 → multiloop-0.1.3}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  69. {multiloop-0.1.1 → multiloop-0.1.3}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  70. {multiloop-0.1.1 → multiloop-0.1.3}/.github/dependabot.yml +0 -0
  71. {multiloop-0.1.1 → multiloop-0.1.3}/.github/pull_request_template.md +0 -0
  72. {multiloop-0.1.1 → multiloop-0.1.3}/.github/release-drafter.yml +0 -0
  73. {multiloop-0.1.1 → multiloop-0.1.3}/.github/workflows/ci.yml +0 -0
  74. {multiloop-0.1.1 → multiloop-0.1.3}/.github/workflows/publish.yml +0 -0
  75. {multiloop-0.1.1 → multiloop-0.1.3}/.github/workflows/release-drafter.yml +0 -0
  76. {multiloop-0.1.1 → multiloop-0.1.3}/.gitignore +0 -0
  77. {multiloop-0.1.1 → multiloop-0.1.3}/.pre-commit-config.yaml +0 -0
  78. {multiloop-0.1.1 → multiloop-0.1.3}/.python-version +0 -0
  79. {multiloop-0.1.1 → multiloop-0.1.3}/CODEOWNERS +0 -0
  80. {multiloop-0.1.1 → multiloop-0.1.3}/CODE_OF_CONDUCT.md +0 -0
  81. {multiloop-0.1.1 → multiloop-0.1.3}/LICENSE +0 -0
  82. {multiloop-0.1.1 → multiloop-0.1.3}/SECURITY.md +0 -0
  83. {multiloop-0.1.1 → multiloop-0.1.3}/benchmarks/bench_multithread_loops.py +0 -0
  84. {multiloop-0.1.1 → multiloop-0.1.3}/benchmarks/benchmark_pull_model.py +0 -0
  85. {multiloop-0.1.1 → multiloop-0.1.3}/build.rs +0 -0
  86. {multiloop-0.1.1 → multiloop-0.1.3}/deny.toml +0 -0
  87. {multiloop-0.1.1 → multiloop-0.1.3}/examples/00_pool_basics.py +0 -0
  88. {multiloop-0.1.1 → multiloop-0.1.3}/examples/01_channels_select.py +0 -0
  89. {multiloop-0.1.1 → multiloop-0.1.3}/examples/02_waitgroup_once.py +0 -0
  90. {multiloop-0.1.1 → multiloop-0.1.3}/examples/03_taskgroup_timeout.py +0 -0
  91. {multiloop-0.1.1 → multiloop-0.1.3}/examples/04_sync_primitives.py +0 -0
  92. {multiloop-0.1.1 → multiloop-0.1.3}/rust-toolchain.toml +0 -0
  93. {multiloop-0.1.1 → multiloop-0.1.3}/src/multiloop/_logging.py +0 -0
  94. {multiloop-0.1.1 → multiloop-0.1.3}/src/multiloop/_options.py +0 -0
  95. {multiloop-0.1.1 → multiloop-0.1.3}/src/multiloop/_rust.py +0 -0
  96. {multiloop-0.1.1 → multiloop-0.1.3}/src/multiloop/py.typed +0 -0
  97. {multiloop-0.1.1 → multiloop-0.1.3}/src/multiloop/testing/__init__.py +0 -0
  98. {multiloop-0.1.1 → multiloop-0.1.3}/src/waitgroup.rs +0 -0
  99. {multiloop-0.1.1 → multiloop-0.1.3}/tests/conftest.py +0 -0
  100. {multiloop-0.1.1 → multiloop-0.1.3}/tests/test_cancel_scope.py +0 -0
  101. {multiloop-0.1.1 → multiloop-0.1.3}/tests/test_docs.py +0 -0
  102. {multiloop-0.1.1 → multiloop-0.1.3}/tests/test_free_threading.py +0 -0
  103. {multiloop-0.1.1 → multiloop-0.1.3}/tests/test_go_parity.py +0 -0
  104. {multiloop-0.1.1 → multiloop-0.1.3}/tests/test_logging.py +0 -0
  105. {multiloop-0.1.1 → multiloop-0.1.3}/tests/test_loop_factory.py +0 -0
  106. {multiloop-0.1.1 → multiloop-0.1.3}/tests/test_perf_regression.py +0 -0
  107. {multiloop-0.1.1 → multiloop-0.1.3}/tests/test_sync_condition_barrier.py +0 -0
@@ -34,22 +34,15 @@ invariants, token conservation laws, and multi-thread signal forwarding**.
34
34
  ```
35
35
  multiloop/
36
36
  ├── src/
37
- │ ├── multiloop/ # Python package (22 modules)
37
+ │ ├── multiloop/ # Python package (15 modules)
38
38
  │ │ ├── __init__.py # Public API surface — start here
39
39
  │ │ ├── pool.py # EventLoopThreadPool engine
40
40
  │ │ ├── primitives.py # Channel, select_channel, AsyncWaitGroup, AsyncOnce
41
41
  │ │ ├── context.py # AsyncContext (O(1) set tracking)
42
42
  │ │ ├── _cancel.py # CancelScope, fail_after, move_on_after, shield
43
- │ │ ├── _sync.py # Lock, Semaphore, Event, Condition, Barrier
43
+ │ │ ├── _sync.py # Lock, Semaphore, Event, Condition, Barrier, CapacityLimiter
44
44
  │ │ ├── _taskgroup.py # TaskGroup, TaskHandle
45
45
  │ │ ├── rwlock.py # AsyncRWMutex (async read-write lock, Rust-backed)
46
- │ │ ├── asgi.py # MultiloopASGIWorker (ASGI 3.0, Lifespan, WebSockets, H2)
47
- │ │ ├── _http11.py # Http11Protocol (Rust SIMD httparse & fused TCP write)
48
- │ │ ├── _websocket.py # WebSocketProtocol (Rust SIMD unmasking & RFC 6455)
49
- │ │ ├── _lifespan.py # ASGILifespanManager (ASGI lifespan state machine)
50
- │ │ ├── wsgi.py # MultiloopWSGIWorker (WSGI 1.0.1, PEP 3333 synchronous runner)
51
- │ │ ├── cli.py # multiloop run CLI server runner
52
- │ │ ├── server.py # ConnectionPinningServer (platform-adaptive multi-core listener)
53
46
  │ │ ├── _channel_base.py # Shared waiter deques, _wake_all, _wakeup_next
54
47
  │ │ ├── _rust.py # _try_import_rust_class helper
55
48
  │ │ ├── _metrics.py # MetricsCollector
@@ -62,12 +55,9 @@ multiloop/
62
55
  │ ├── pool.rs # NativeWorkerPool & PollerGuard
63
56
  │ ├── channel.rs # Channel, RawAsyncChannel (Anti-Barging FIFO)
64
57
  │ ├── waitgroup.rs # RawAsyncWaitGroup & WaitGroupInner
65
- │ ├── rwlock.rs # RawAsyncRWMutex (64-bit atomic state machine)
66
- │ ├── websocket.rs # FastWebSocketParser & SIMD fast_websocket_unmask
67
- │ ├── http.rs # FastHttpParser (SIMD httparse & zero-alloc ASGI assembly)
68
- │ └── h2.rs # PyH2Bridge, serve_h2_connection (Tokio H2 Runtime)
69
- ├── tests/ # 27 test files (pytest + pytest-asyncio)
70
- ├── benchmarks/ # 4 benchmark scripts
58
+ │ └── rwlock.rs # RawAsyncRWMutex (64-bit atomic state machine)
59
+ ├── tests/ # 22 test files (pytest + pytest-asyncio)
60
+ ├── benchmarks/ # Multi-thread benchmarks
71
61
  ├── examples/ # Runnable examples (python examples/00_*.py)
72
62
  ├── docs/
73
63
  │ ├── API.md # Complete API reference
@@ -168,14 +158,13 @@ searches, never modify.
168
158
  `_worker_dispatcher` is the per-worker event loop that calls `pop_work()`
169
159
  and spawns tasks.
170
160
 
171
- 3. **`src/lib.rs`** — Rust backend. Four `#[pyclass]` types: `NativeWorkerPool`
172
- (global + per-worker flume queues, batch-pull pop_work), `Channel`
173
- (lock-free flume channel), `AtomicMetrics` (padded atomic counters),
174
- `RawAsyncWaitGroup` (atomic counter + mutex-protected waiter list).
161
+ 3. **`src/lib.rs`** — Rust backend. Five `#[pyclass]` types: `NativeWorkerPool`
162
+ (global + per-worker flume queues, batch-pull pop_work), `RawAsyncChannel`
163
+ (native async channel with anti-barging FIFO), `AtomicMetrics` (padded atomic counters),
164
+ `RawAsyncWaitGroup` (atomic counter + mutex-protected waiter list), and `RawAsyncRWMutex`.
175
165
 
176
- 4. **`src/multiloop/primitives.py`** — `Channel` Python wrapper with the
177
- double-checked lock pattern, `select_channel`, `AsyncWaitGroup`,
178
- `AsyncOnce`.
166
+ 4. **`src/multiloop/primitives.py`** — `Channel` Python facade over native Rust
167
+ `RawAsyncChannel`, `select_channel`, `AsyncWaitGroup`, `AsyncOnce`.
179
168
 
180
169
  5. **`src/multiloop/_cancel.py`** — `CancelScope` with shield semantics, using
181
170
  `task.uncancel()` / `task.cancel()` snapshot/restore on Python 3.11+.
@@ -197,7 +186,6 @@ __init__.py ──┬── pool.py ────────── _rust.py ─
197
186
  ├── _taskgroup.py
198
187
  ├── context.py
199
188
  ├── rwlock.py
200
- ├── asgi.py ────────── server.py
201
189
  ├── exceptions.py
202
190
  ├── _metrics.py
203
191
  ├── _options.py
@@ -270,9 +258,6 @@ pops so no single worker greedily drains the global queue.
270
258
  | `AtomicMetrics` | `src/metrics.rs` | `std::sync::atomic` | 64-byte-padded per-worker counters (`active`, `completed`, `global_pull_count`, `park_count`, etc.) — prevents false sharing |
271
259
  | `RawAsyncWaitGroup` | `src/waitgroup.rs` | parking_lot `Mutex<WaitGroupInner>` | Go-style atomic counter + generation + waiter list with single-mutex state machine |
272
260
  | `RawAsyncRWMutex` | `src/rwlock.rs` | parking_lot `Mutex<RWMutexInner>` | 64-bit atomic state machine, writer-preference async read-write lock with cancellation cleanup |
273
- | `FastHttpParser` | `src/http.rs` | httparse | SIMD zero-copy HTTP/1.x header parser with zero-alloc ASGI PyList direct assembly & interned methods |
274
- | `FastWebSocketParser` & `fast_websocket_unmask` | `src/websocket.rs` | PyO3 | SIMD 64-bit chunked XOR frame unmasking and zero-copy RFC 6455 frame header parsing |
275
- | `PyH2Bridge` & `serve_h2_connection` | `src/h2.rs` | tokio + h2 | Tokio HTTP/2 async multiplexing runtime bridge |
276
261
 
277
262
  ### Python-side patterns
278
263
 
@@ -291,17 +276,17 @@ pops so no single worker greedily drains the global queue.
291
276
  while re-acquiring the lock after being notified, it automatically forwards
292
277
  the notification to the next waiter to conserve notification tokens.
293
278
 
294
- ### Nine non-obvious design decisions
279
+ ### Seven non-obvious design decisions
295
280
 
296
281
  These are the places where a change that looks like a simplification usually
297
282
  breaks a real correctness or performance property. **Read each before modifying
298
283
  the related code.**
299
284
 
300
- 1. **Double-check lock in `Channel`** (`primitives.py:150-227`):
301
- The flume queue is lock-free, but the Python waiter deques are not. A
302
- fast-path `try_send`/`try_recv` outside the lock, followed by a re-check
303
- under the lock, closes the lost-wakeup window between the lock-free buffer
304
- and the locked waiter list.
285
+ 1. **Anti-barging FIFO token conservation in `Channel`** (`channel.rs:270-360`, `primitives.py:180-240`):
286
+ `RawAsyncChannel` enforces strict FIFO ordering so external `try_send` cannot barge ahead
287
+ of queued putters. Woken putters hold reservations via `in_flight_putters` until `claim_put`.
288
+ If a woken putter is cancelled, `unregister_putter` automatically forwards the reservation
289
+ to the next queued putter or decrements the reservation count, conserving tokens and preventing deadlocks.
305
290
 
306
291
  2. **`CancelScope` shield semantics** (`_cancel.py:97-205`):
307
292
  Shielded scopes snapshot and clear `task.cancelling()`, then restore it on
@@ -338,22 +323,6 @@ the related code.**
338
323
  full, preserving liveness. Drain phase validates all three sources (global queue,
339
324
  private buffer, local channel) are completely empty before worker loop termination.
340
325
 
341
- 8. **Darwin vs Linux `SO_REUSEPORT` asymmetric routing trap** (`src/multiloop/server.py:99-130`):
342
- Linux `SO_REUSEPORT` hashes 4-tuples across multiple listening sockets with kernel-level
343
- load balancing. On macOS (Darwin/BSD), `SO_REUSEPORT` does not implement symmetric
344
- hashing and routes 100% of loopback connections to the newest bound socket, causing
345
- severe worker starvation and degrading multi-core throughput to single-worker limits (~50k QPS).
346
- `server.py` restricts `SO_REUSEPORT` to Linux only; on macOS/Darwin, workers share a single
347
- listening socket and race concurrently on `loop.sock_accept(shared_sock)`, guaranteeing
348
- perfect 25% load distribution and ~91k+ multi-core QPS.
349
-
350
- 9. **Python 3.14t Free-Threaded memory safety via `PyBytes::new_with`** (`src/websocket.rs:80-110`):
351
- Under Python 3.14t (No-GIL), modifying Python buffer objects in-place across threads
352
- causes data races and invalidates Python's immutability invariant. Rust SIMD extensions must
353
- allocate Python objects through atomic single-pass constructors like
354
- `PyBytes::new_with(py, len, |buf| ...)` to populate unmasked payload bytes without
355
- intermediate copies or in-place mutations.
356
-
357
326
  ---
358
327
 
359
328
  ## 6. Quick Commands
@@ -5,6 +5,46 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.1.3] - 2026-09-17
9
+
10
+ ### Added & Optimized
11
+ - **Cross-Loop Structured Concurrency (`TaskGroup` & `AsyncContext`)**:
12
+ - `TaskGroup(pool=...)` multi-loop task distribution with isolated per-task child `CancelScope` instances.
13
+ - Remote drain barrier on context exit, bidirectional cascading cancellation, and unified `ExceptionGroup` aggregation.
14
+ - Unified `AsyncContext.task_group(pool=...)` lifecycle tracking and automatic cascading cancellation.
15
+ - **Native Synchronous Channel Communication (`Channel.send_sync` & `Channel.recv_sync`)**:
16
+ - Replaced busy-spin polling with native `parking_lot::Condvar` wait/notify in `RawAsyncChannel`.
17
+ - Releases the Python GIL via `py.detach()` during blocking waits, eliminating CPU waste.
18
+ - Added `ReceiveChannel.recv_sync(timeout=None)` to segregation views.
19
+ - **Concurrency & Free-Threaded (Python 3.14t) Hardening**:
20
+ - `AsyncRWMutex`: Protected reentrancy depth and writer task with `self._depth_lock = threading.Lock()`, with out-of-lock `_wake_all()` execution to eliminate deadlocks.
21
+ - `EventLoopThreadPool`: Implemented condition-variable drain barrier `self._drain_barrier` and event-driven worker dispatcher.
22
+ - `AtomicMetrics`: Added `add_global_pull` batch counter accumulation and upgraded pool metrics to `RwLock`.
23
+ - `_channel_base.py`: Enforced $O(1)$ waiter unregistration via `OrderedDict.pop()`.
24
+ - `AsyncWaitGroup`: Removed GC finalizer `self._wg.done()` invocation in `_TrackedCoroutine.__del__` to prevent cross-thread re-entrancy and deadlocks under multi-threaded GC.
25
+ - Standardized cross-language `ThreadPoolClosedError` exception hierarchy.
26
+
27
+ ## [0.1.2] - 2026-08-21
28
+
29
+ ### Added & Optimized
30
+ - **wrk High-Concurrency Multi-Core Benchmark Suite (`benchmarks/bench_wrk_asgi.py`)**:
31
+ - Production-grade wrk benchmark suite for physical multi-core scaling under Python 3.14t No-GIL.
32
+ - Achieves **151,366+ QPS** (4-Worker) on `/api/plaintext` and **145,836+ QPS** on `/api/ping` with sub-millisecond latency (0.29ms avg).
33
+ - **Rust SIMD HTTP Sliced Streaming & Zero-Allocation Fast-Path (`src/http.rs`, `src/multiloop/_http11.py`)**:
34
+ - `FastHttpConnection` streaming body sliced event dispatch (`ReceivingContentLength`) eliminating cursor rewind and $O(N^2)$ header re-parsing on split TCP packets.
35
+ - $O(1)$ buffer compaction via `compact_buffer` clearing on cursor drain without memory copies.
36
+ - Fast-path for zero-body GET/HEAD requests with module-level singleton `_EMPTY_BODY_MSG`, completely eliminating `asyncio.Queue` heap allocation and event loop dispatch overhead.
37
+ - **ASGI Transport Backpressure & Pipelining Concurrency Protection (`src/multiloop/_http11.py`, `src/multiloop/_websocket.py`)**:
38
+ - Physical write backpressure flow control (`_drain_event`) in `Http11Protocol.send()` eliminating server OOM under slow clients.
39
+ - Serial HTTP Pipelining request queueing (`_pending_pipeline_events`) guaranteeing strictly ordered, non-interleaved TCP responses.
40
+ - RFC 6455 WebSocket thread-safe send frame lock synchronization (`_send_lock`), eliminating `RuntimeError: concurrent drain calls` on high-concurrency data/control frame writes.
41
+ - **WSGI True Streaming Channel & Client Disconnect Decoupling (`src/multiloop/wsgi.py`)**:
42
+ - `SyncStreamReader` backed by lock-free cross-thread `Channel(maxsize=16)`, eliminating the 10MB pre-buffering requirement and enabling true streaming request body consumption.
43
+ - Automatic channel closure and feeder cancellation upon client disconnection, preventing orphaned synchronous WSGI worker tasks from occupying the thread pool.
44
+ - **No-GIL Task Collection Thread Safety & Adaptive CLI Watcher (`src/multiloop/server.py`, `src/multiloop/cli.py`)**:
45
+ - `ConnectionPinningServer` multi-worker task collection mutex protection (`_tasks_lock`), eliminating `RuntimeError: Set changed size during iteration` during `server.close()` under Python 3.14t physical multi-core execution.
46
+ - CLI file watcher with extended ignored directories and adaptive smooth polling backoff (0.3s~0.8s), reducing idle CPU usage while maintaining fast hot-reload responsiveness.
47
+
8
48
  ## [0.1.1] - 2026-08-18
9
49
 
10
50
  ### Added & Optimized
@@ -7,5 +7,5 @@ authors:
7
7
  email: "hankaihong@outlook.com"
8
8
  repository-code: "https://github.com/hankaihong1/multiloop"
9
9
  license: "MIT"
10
- version: "0.1.1"
11
- date-released: 2026-08-18
10
+ version: "0.1.3"
11
+ date-released: 2026-09-17
@@ -122,8 +122,6 @@ Performance-sensitive changes should be validated against the benchmark suite:
122
122
  ```bash
123
123
  uv run python benchmarks/bench_multithread_loops.py
124
124
  uv run python benchmarks/benchmark_pull_model.py
125
- uv run python benchmarks/bench_asgi_throughput.py
126
- uv run python benchmarks/benchmark_winuvloop.py
127
125
  ```
128
126
 
129
127
  ---
@@ -2,12 +2,6 @@
2
2
  # It is not intended for manual editing.
3
3
  version = 4
4
4
 
5
- [[package]]
6
- name = "atomic-waker"
7
- version = "1.1.2"
8
- source = "registry+https://github.com/rust-lang/crates.io-index"
9
- checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
10
-
11
5
  [[package]]
12
6
  name = "bitflags"
13
7
  version = "2.13.1"
@@ -20,24 +14,12 @@ version = "3.20.3"
20
14
  source = "registry+https://github.com/rust-lang/crates.io-index"
21
15
  checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
22
16
 
23
- [[package]]
24
- name = "bytes"
25
- version = "1.12.1"
26
- source = "registry+https://github.com/rust-lang/crates.io-index"
27
- checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
28
-
29
17
  [[package]]
30
18
  name = "cfg-if"
31
19
  version = "1.0.4"
32
20
  source = "registry+https://github.com/rust-lang/crates.io-index"
33
21
  checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
34
22
 
35
- [[package]]
36
- name = "equivalent"
37
- version = "1.0.2"
38
- source = "registry+https://github.com/rust-lang/crates.io-index"
39
- checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
40
-
41
23
  [[package]]
42
24
  name = "flume"
43
25
  version = "0.11.1"
@@ -50,12 +32,6 @@ dependencies = [
50
32
  "spin",
51
33
  ]
52
34
 
53
- [[package]]
54
- name = "fnv"
55
- version = "1.0.7"
56
- source = "registry+https://github.com/rust-lang/crates.io-index"
57
- checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
58
-
59
35
  [[package]]
60
36
  name = "futures-core"
61
37
  version = "0.3.33"
@@ -99,69 +75,12 @@ dependencies = [
99
75
  "wasm-bindgen",
100
76
  ]
101
77
 
102
- [[package]]
103
- name = "h2"
104
- version = "0.4.16"
105
- source = "registry+https://github.com/rust-lang/crates.io-index"
106
- checksum = "a9f37a958b41b3b19ee2707c06439c0e9e547e847223eb791ecb0cb821c65e27"
107
- dependencies = [
108
- "atomic-waker",
109
- "bytes",
110
- "fnv",
111
- "futures-core",
112
- "futures-sink",
113
- "http",
114
- "indexmap",
115
- "slab",
116
- "tokio",
117
- "tokio-util",
118
- "tracing",
119
- ]
120
-
121
- [[package]]
122
- name = "hashbrown"
123
- version = "0.17.1"
124
- source = "registry+https://github.com/rust-lang/crates.io-index"
125
- checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
126
-
127
78
  [[package]]
128
79
  name = "heck"
129
80
  version = "0.5.0"
130
81
  source = "registry+https://github.com/rust-lang/crates.io-index"
131
82
  checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
132
83
 
133
- [[package]]
134
- name = "http"
135
- version = "1.5.0"
136
- source = "registry+https://github.com/rust-lang/crates.io-index"
137
- checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"
138
- dependencies = [
139
- "bytes",
140
- "itoa",
141
- ]
142
-
143
- [[package]]
144
- name = "httparse"
145
- version = "1.10.1"
146
- source = "registry+https://github.com/rust-lang/crates.io-index"
147
- checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
148
-
149
- [[package]]
150
- name = "indexmap"
151
- version = "2.14.0"
152
- source = "registry+https://github.com/rust-lang/crates.io-index"
153
- checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
154
- dependencies = [
155
- "equivalent",
156
- "hashbrown",
157
- ]
158
-
159
- [[package]]
160
- name = "itoa"
161
- version = "1.0.18"
162
- source = "registry+https://github.com/rust-lang/crates.io-index"
163
- checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
164
-
165
84
  [[package]]
166
85
  name = "js-sys"
167
86
  version = "0.3.103"
@@ -188,30 +107,14 @@ dependencies = [
188
107
  "scopeguard",
189
108
  ]
190
109
 
191
- [[package]]
192
- name = "mio"
193
- version = "1.2.2"
194
- source = "registry+https://github.com/rust-lang/crates.io-index"
195
- checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427"
196
- dependencies = [
197
- "libc",
198
- "wasi",
199
- "windows-sys",
200
- ]
201
-
202
110
  [[package]]
203
111
  name = "multiloop-core"
204
- version = "0.1.1"
112
+ version = "0.1.3"
205
113
  dependencies = [
206
- "bytes",
207
114
  "flume",
208
- "h2",
209
- "http",
210
- "httparse",
211
115
  "parking_lot",
212
116
  "pyo3",
213
117
  "pyo3-build-config",
214
- "tokio",
215
118
  ]
216
119
 
217
120
  [[package]]
@@ -315,7 +218,7 @@ dependencies = [
315
218
  "proc-macro2",
316
219
  "pyo3-macros-backend",
317
220
  "quote",
318
- "syn 2.0.119",
221
+ "syn",
319
222
  ]
320
223
 
321
224
  [[package]]
@@ -327,7 +230,7 @@ dependencies = [
327
230
  "heck",
328
231
  "proc-macro2",
329
232
  "quote",
330
- "syn 2.0.119",
233
+ "syn",
331
234
  ]
332
235
 
333
236
  [[package]]
@@ -372,16 +275,6 @@ version = "1.15.2"
372
275
  source = "registry+https://github.com/rust-lang/crates.io-index"
373
276
  checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
374
277
 
375
- [[package]]
376
- name = "socket2"
377
- version = "0.6.5"
378
- source = "registry+https://github.com/rust-lang/crates.io-index"
379
- checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
380
- dependencies = [
381
- "libc",
382
- "windows-sys",
383
- ]
384
-
385
278
  [[package]]
386
279
  name = "spin"
387
280
  version = "0.9.9"
@@ -402,82 +295,12 @@ dependencies = [
402
295
  "unicode-ident",
403
296
  ]
404
297
 
405
- [[package]]
406
- name = "syn"
407
- version = "3.0.3"
408
- source = "registry+https://github.com/rust-lang/crates.io-index"
409
- checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"
410
- dependencies = [
411
- "proc-macro2",
412
- "quote",
413
- "unicode-ident",
414
- ]
415
-
416
298
  [[package]]
417
299
  name = "target-lexicon"
418
300
  version = "0.13.5"
419
301
  source = "registry+https://github.com/rust-lang/crates.io-index"
420
302
  checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
421
303
 
422
- [[package]]
423
- name = "tokio"
424
- version = "1.53.1"
425
- source = "registry+https://github.com/rust-lang/crates.io-index"
426
- checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed"
427
- dependencies = [
428
- "bytes",
429
- "libc",
430
- "mio",
431
- "pin-project-lite",
432
- "socket2",
433
- "tokio-macros",
434
- "windows-sys",
435
- ]
436
-
437
- [[package]]
438
- name = "tokio-macros"
439
- version = "2.7.2"
440
- source = "registry+https://github.com/rust-lang/crates.io-index"
441
- checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e"
442
- dependencies = [
443
- "proc-macro2",
444
- "quote",
445
- "syn 3.0.3",
446
- ]
447
-
448
- [[package]]
449
- name = "tokio-util"
450
- version = "0.7.19"
451
- source = "registry+https://github.com/rust-lang/crates.io-index"
452
- checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52"
453
- dependencies = [
454
- "bytes",
455
- "futures-core",
456
- "futures-sink",
457
- "libc",
458
- "pin-project-lite",
459
- "tokio",
460
- ]
461
-
462
- [[package]]
463
- name = "tracing"
464
- version = "0.1.44"
465
- source = "registry+https://github.com/rust-lang/crates.io-index"
466
- checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
467
- dependencies = [
468
- "pin-project-lite",
469
- "tracing-core",
470
- ]
471
-
472
- [[package]]
473
- name = "tracing-core"
474
- version = "0.1.36"
475
- source = "registry+https://github.com/rust-lang/crates.io-index"
476
- checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
477
- dependencies = [
478
- "once_cell",
479
- ]
480
-
481
304
  [[package]]
482
305
  name = "unicode-ident"
483
306
  version = "1.0.24"
@@ -522,7 +345,7 @@ dependencies = [
522
345
  "bumpalo",
523
346
  "proc-macro2",
524
347
  "quote",
525
- "syn 2.0.119",
348
+ "syn",
526
349
  "wasm-bindgen-shared",
527
350
  ]
528
351
 
@@ -540,12 +363,3 @@ name = "windows-link"
540
363
  version = "0.2.1"
541
364
  source = "registry+https://github.com/rust-lang/crates.io-index"
542
365
  checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
543
-
544
- [[package]]
545
- name = "windows-sys"
546
- version = "0.61.2"
547
- source = "registry+https://github.com/rust-lang/crates.io-index"
548
- checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
549
- dependencies = [
550
- "windows-link",
551
- ]
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "multiloop-core"
3
- version = "0.1.1"
3
+ version = "0.1.3"
4
4
  edition = "2021"
5
5
  readme = "README.md"
6
6
 
@@ -12,11 +12,6 @@ crate-type = ["cdylib", "rlib"]
12
12
  pyo3 = "0.29"
13
13
  flume = "0.11"
14
14
  parking_lot = "0.12"
15
- httparse = "1.10.1"
16
- h2 = "0.4.16"
17
- http = "1.5.0"
18
- bytes = "1.12.1"
19
- tokio = { version = "1.53.1", features = ["rt", "rt-multi-thread", "net", "io-util", "macros", "sync"] }
20
15
 
21
16
  [build-dependencies]
22
17
  pyo3-build-config = "0.29"
@@ -28,7 +23,7 @@ test-init = ["pyo3/auto-initialize"]
28
23
 
29
24
  [profile.release]
30
25
  opt-level = 3
31
- lto = true
26
+ lto = "thin"
32
27
  codegen-units = 1
33
28
  panic = "unwind"
34
- strip = true
29
+ strip = false
@@ -16,7 +16,7 @@ test-slow:
16
16
  uv run pytest -m slow -o addopts=""
17
17
 
18
18
  bench:
19
- for f in benchmarks/benchmark_pull_model.py benchmarks/bench_asgi_throughput.py benchmarks/bench_multithread_loops.py; do \
19
+ for f in benchmarks/benchmark_pull_model.py benchmarks/bench_multithread_loops.py; do \
20
20
  uv run python "$$f"; \
21
21
  done
22
22