mfyuce opened a new pull request, #3517:
URL: https://github.com/apache/iggy/pull/3517

   ## Summary
   
   `IORING_SETUP_COOP_TASKRUN` requires Linux ≥ 5.19. On kernels 5.10–5.18 the
   shard io_uring setup fails with `EINVAL` even though the main runtime starts
   fine, preventing server boot entirely. These three commits fix that in order:
   
   1. **Gate COOP_TASKRUN flags behind an env var** 
(`IGGY_SHARD_RUNTIME_COOP_TASKRUN`,
      default `true` = unchanged). Set it to `false` to run on 5.10–5.19 kernels
      at a small latency cost. (`feat(server)`)
   
   2. **Keep asyncify worker pool when COOP_TASKRUN is off.** With the flag off,
      compio routes fs/JWT-storage ops through the asyncify thread pool.
      `thread_pool_limit(0)` then panics "thread pool is needed but no worker
      thread is running" on shard 0. Gate the `thread_pool_limit(0)` call behind
      the same flag. (`fix(server)`)
   
   3. **Decouple `thread_pool_limit` from COOP_TASKRUN entirely.** TCP, HTTP, 
and
      WebSocket transports dispatch some ops through the asyncify pool even when
      `COOP_TASKRUN=true`, so tying `thread_pool_limit(0)` to the flag still
      panics on 6.8+ kernels with those transports active. Add a
      `keep_worker_pool: bool` parameter to `create_shard_executor`; the pool is
      only dropped when `COOP_TASKRUN=true` **and** no TCP/HTTP/WS transport is
      enabled. Both `server` and `server-ng` derive `keep_worker_pool` from 
their
      loaded config. (`fix(server)`)
   
   After these changes, operators can set `IGGY_SHARD_RUNTIME_COOP_TASKRUN=true`
   on Linux 6.8+ with TCP transport enabled and get lower io_uring latency 
without
   the worker-pool panic. On ≤5.18 kernels they set it to `false` and the server
   boots normally.
   
   ## Files changed
   
   - `core/server_common/src/executor.rs` — 
`create_shard_executor(keep_worker_pool: bool)`, flag-gated 
`COOP_TASKRUN`/`TASKRUN_FLAG`
   - `core/server/src/main.rs` — derive `keep_worker_pool` from config
   - `core/server-ng/src/main.rs`, `core/server-ng/src/bootstrap.rs` — same
   
   ## Test plan
   
   - [ ] `cargo clippy -p server -p server-ng -- -D warnings` passes
   - [ ] Server boots on Linux 5.15 with 
`IGGY_SHARD_RUNTIME_COOP_TASKRUN=false` + TCP transport
   - [ ] Server boots on Linux 6.8 with `IGGY_SHARD_RUNTIME_COOP_TASKRUN=true` 
+ TCP transport (no worker-pool panic)
   - [ ] `cargo test -p server_common` passes
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_018duZYBkbguQ2pn8RJ82PUw


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to