Shutdown Check

Search documentation

Find a page or section

SC312: Work finished too soon to test rejection

SC312 (work finished too soon to test rejection) means in-flight work ended before the new request could be sent during drain. Use a longer-running workload.

SC312 means the active workload ended before shutdown-check could send the new request. Without older work still draining, the test cannot prove how the service handles traffic during a drain.

CodeSC312 FAIL
StageDraining traffic
CLI exit code1
What it meansThe in-flight work had already finished when the new request was due, so rejection during drain could not be observed.
Message
  • Work finished before new-request rejection could be checked; use a longer-running workload
First thing to checkUse a longer-running test workload, so old work is still draining when the new request is sent.

How do I fix it?

  1. Make the controlled workload run longer.
  2. Withdraw readiness immediately after SIGTERM.
  3. Remove unnecessary delays before changing the readiness state.
  4. Keep the new-request route fast enough to return before the deadline.

The workload should stay active long enough for readiness polling and the new request, but still finish comfortably before shutdown.deadlineMs.

Do not disable the rejection check merely to hide the timing problem. If your production platform can route traffic during shutdown, keep the check and make the test window reliable.

How do I verify the fix?

The corrected order is readiness withdrawn, then new request rejected, then work request finished. Run several times on CI to confirm the old work does not finish first under load.

If readiness withdrawal itself is slow, fix that state change rather than adding an excessive artificial delay to the workload.