Fix potential statifier wedging #610

Merged
paratoxic merged 7 commits from fix-stratifer-wedge into master 2026-08-23 16:57:40 +00:00
Owner

Fixes this:

M1. Slow reader wedges session — src/stratifier.rs

ckpool: never writes to a client socket inline. A sender thread drains a
queue with non-blocking writes; a client blocked > 60 s is disconnected
(connector.c:730-777). Receive side: disconnect if buffer > 1024 B without
EOL (connector.c:494-573).

Design (para):

  • Per-connection writer task. Bounded mpsc::channel<String> (capacity ~64).
    Writer drains frames into the existing
    FramedWrite<OwnedWriteHalf, LinesCodec>.
  • send() becomes try_send. On full channel: close the connection
    (ckpool's drop-on-stall equivalent). Precedent: send_event at
    src/stratifier.rs:1231-1237.
  • Keep ordering: single writer task guarantees frame order.
  • Shutdown: writer owns the write half; serve() breaks -> drop sender ->
    writer flushes and exits. Drop for Stratifier (:1240-1266) unchanged.
  • Error propagation: writer death closes the channel; tx.closed() in the
    serve() select loop breaks the connection.
  • Reader already has LinesCodec::new_with_max_length(MAX_MESSAGE_SIZE) — no
    change needed.

Constraint: request/response ordering is pinned by integration tests
(tests/pool.rs:220-264, bouncer test :1261-1460). Writer task preserves
it.

Fixes this: ## M1. Slow reader wedges session — `src/stratifier.rs` **ckpool:** never writes to a client socket inline. A sender thread drains a queue with non-blocking writes; a client blocked > 60 s is disconnected (`connector.c:730-777`). Receive side: disconnect if buffer > 1024 B without EOL (`connector.c:494-573`). **Design (para):** - Per-connection writer task. Bounded `mpsc::channel<String>` (capacity ~64). Writer drains frames into the existing `FramedWrite<OwnedWriteHalf, LinesCodec>`. - `send()` becomes `try_send`. On full channel: close the connection (ckpool's drop-on-stall equivalent). Precedent: `send_event` at `src/stratifier.rs:1231-1237`. - Keep ordering: single writer task guarantees frame order. - Shutdown: writer owns the write half; `serve()` breaks -> drop sender -> writer flushes and exits. `Drop for Stratifier` (`:1240-1266`) unchanged. - Error propagation: writer death closes the channel; `tx.closed()` in the `serve()` select loop breaks the connection. - Reader already has `LinesCodec::new_with_max_length(MAX_MESSAGE_SIZE)` — no change needed. **Constraint:** request/response ordering is pinned by integration tests (`tests/pool.rs:220-264`, bouncer test `:1261-1460`). Writer task preserves it.
Fix potential statifier wedging
Some checks failed
CI / ckpool (pull_request) Successful in 39s
CI / lint (pull_request) Successful in 3m45s
CI / test-linux (pull_request) Has been cancelled
13a1d3ea01
Fix
Some checks failed
CI / ckpool (pull_request) Successful in 29s
CI / lint (pull_request) Successful in 3m8s
CI / test-linux (pull_request) Failing after 14m35s
de5c0dc65b
Merge branch 'master' of ssh://git.parasite.dev/parasitepool/para into fix-stratifer-wedge
Some checks failed
CI / ckpool (pull_request) Successful in 28s
CI / lint (pull_request) Successful in 3m51s
CI / test-linux (pull_request) Failing after 12m24s
f1280500f5
Merge branch 'master' into fix-stratifer-wedge
Some checks failed
CI / lint (pull_request) Successful in 3m42s
CI / ckpool (pull_request) Successful in 1m3s
CI / test-linux (pull_request) Has been cancelled
bab43af19f
Merge branch 'fix-stratifer-wedge' of ssh://git.parasite.dev/parasitepool/para into fix-stratifer-wedge
Some checks failed
CI / ckpool (pull_request) Successful in 37s
CI / lint (pull_request) Successful in 4m2s
CI / test-linux (pull_request) Failing after 12m24s
eba3c62bfb
Fix
Some checks failed
CI / ckpool (pull_request) Successful in 29s
CI / lint (pull_request) Successful in 2m58s
CI / test-linux (pull_request) Failing after 12m47s
5cbbec8a3c
paratoxic merged commit db90fcece4 into master 2026-08-23 16:57:40 +00:00
paratoxic deleted branch fix-stratifer-wedge 2026-08-23 16:57:40 +00:00
Sign in to join this conversation.
No description provided.