competition-race-condition-state-drift

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Competition Race Condition State Drift

竞赛场景Race Condition状态漂移

Use this skill only as a downstream specialization after
$ctf-sandbox-orchestrator
is already active and has established sandbox assumptions, node ownership, and evidence priorities. If that has not happened yet, return to
$ctf-sandbox-orchestrator
first.
Use this skill when the decisive behavior depends on request timing, async ordering, lock gaps, or stale state.
Reply in Simplified Chinese unless the user explicitly requests English.
仅可在
$ctf-sandbox-orchestrator
已处于活跃状态,且完成沙箱假设、节点所有权及证据优先级设定后,才可以将此技能作为下游专项技能使用。若尚未完成上述准备,请先返回
$ctf-sandbox-orchestrator
流程。
当决定性行为依赖于请求时序、异步执行顺序、锁间隙或脏状态时,请使用此技能。
除非用户明确要求英文回复,否则请使用简体中文回复。

Quick Start

快速开始

  1. Identify mutable state first: rows, cache keys, queue payloads, session fields, counters, or files.
  2. Reproduce with smallest concurrent sequence and fixed timing assumptions.
  3. Capture one baseline run and one racing run with only one variable changed.
  4. Track read, check, write, enqueue, and commit boundaries separately.
  5. Prove final state drift from a clean reset.
  1. 首先识别可变状态:行数据、缓存键、队列负载、会话字段、计数器或文件。
  2. 使用最小并发序列和固定时序假设进行复现。
  3. 捕获仅修改一个变量的基准运行和竞态运行结果。
  4. 分别追踪读、检查、写、入队、提交边界。
  5. 从干净重置状态出发,证明最终状态漂移的存在。

Workflow

工作流

1. Map Mutable Boundaries

1. 映射可变边界

  • Record transaction scope, lock behavior, retry logic, idempotency keys, cache invalidation, and queue handoff.
  • Note where read-check-write is split across requests, workers, or services.
  • Keep each boundary tied to exact timestamps or sequence numbers.
  • 记录事务范围、锁行为、重试逻辑、幂等键、缓存失效和队列切换逻辑。
  • 标记read-check-write流程在请求、工作器或服务之间的拆分位置。
  • 为每个边界绑定精确的时间戳或序列号。

2. Reproduce Timing Window

2. 复现时序窗口

  • Build deterministic concurrent inputs with controlled delay, duplicate requests, or reordered worker execution.
  • Compare accepted and rejected paths under identical payloads.
  • Record which condition flips when ordering changes.
  • 通过受控延迟、重复请求或重排工作器执行顺序,构造确定性并发输入。
  • 对比相同负载下的接受和拒绝路径。
  • 记录顺序变化时触发翻转的条件。

3. Reduce To Decisive Race Chain

3. 提炼为决定性竞态链

  • Compress to: request A and B ordering -> stale check or lock gap -> conflicting writes -> resulting capability or artifact.
  • State whether root cause is missing lock, weak idempotency, stale cache read, delayed async commit, or retry side effect.
  • If the path becomes queue-dominant, hand off to queue worker drift skill.
  • 压缩为如下链路:请求A和B的顺序 -> 脏检查或锁间隙 -> 冲突写入 -> 最终产生的权限或产物。
  • 说明根因是缺失锁、弱幂等性、脏缓存读、异步提交延迟,或是重试副作用。
  • 如果路径以队列主导,请移交到队列工作器漂移技能。

Read This Reference

参考资料

  • Load
    references/race-condition-state-drift.md
    for race harness ideas, evidence blocks, and parity checks.
  • 加载
    references/race-condition-state-drift.md
    获取竞态测试框架思路、证据块和一致性校验方法。

What To Preserve

需要留存的内容

  • Mutable keys, transaction boundaries, lock behavior, and idempotency markers
  • Timestamped or sequenced traces for baseline and race runs
  • One minimal replayable concurrent sequence proving drift
  • 可变键、事务边界、锁行为和幂等标记
  • 基准运行和竞态运行的带时间戳或序列号的追踪记录
  • 可证明漂移的最小可复现并发序列