Shutdown Check

Search documentation

Find a page or section

SC201: In-flight request was interrupted

SC201 (in-flight request was interrupted) means a request running at SIGTERM was cut off before its response ended. Stop exiting or closing sockets early.

SC201 means an active request lost its connection after SIGTERM. Users often see the same failure as a reset connection or a 502 during deployment.

CodeSC201 FAIL
StageIn-flight responses
CLI exit code1
What it meansA request that was running when SIGTERM arrived was cut off: the connection was reset or closed before the response ended.
Message
  • In-flight request was interrupted: <error>
First thing to checkDo not call process.exit(), closeAllConnections() or destroy sockets while requests are still being answered.

What usually cuts the request off?

  • There is no SIGTERM handler, so Node.js exits immediately.
  • The handler calls process.exit() before requests finish.
  • Code destroys all sockets, including active ones.
  • A wrapper process dies and takes the server with it.
  • A second signal forces an early exit.

How do I fix it?

Use server.close() to stop new connections and wait for its callback before finishing cleanup. Do not destroy active sockets.

process.on("SIGTERM", () => {
  server.close((error) => {
    if (error) process.exitCode = 1;
  });
});

If you track idle keep-alive connections, close only the idle connections. Active responses must be allowed to end normally.

How do I verify the fix?

The request should now end with HTTP <status> instead of aborted, ECONNRESET, or another socket error. The process must exit only after the request-finished event.

Run the test with repeatSignalAfterMs when operators or process managers may send a second signal. This catches an early-exit branch that a single signal does not reach.