Shutdown Check

Search documentation

Find a page or section

SC300: Service did not exit in time

SC300 (service did not exit in time) means the process was still running at the shutdown deadline. Find the open handle keeping Node alive and close it.

SC300 means every tested request finished, but the service process was still running when shutdown.deadlineMs ended. Something in the application remains open after the HTTP drain.

CodeSC300 FAIL
StageProcess exit
CLI exit code1
What it meansThe process was still running when the shutdown deadline passed.
Message
  • Service did not exit within <shutdown.deadlineMs> ms
First thing to checkClose the server, database pools and timers, and let the event loop empty, or exit explicitly once cleanup is done.

What keeps Node.js running?

  • The HTTP server was never closed.
  • A database pool or queue consumer is still connected.
  • An interval, watcher, or background worker is active.
  • Cleanup is waiting on an operation with no timeout.
  • A package-manager or shell wrapper is still running.

How do I fix it?

Log the start and end of every shutdown step. Close resources in an order that does not block active requests, and add timeouts to external cleanup. Let the event loop empty naturally; avoid process.exit() because it can interrupt pending output and requests.

Raise deadlineMs only when the cleanup time is expected and still fits below the platform's termination limit.

How do I find the open handle?

Add a log before and after each close operation. In a development-only run, inspect active handles or temporarily remove cleanup steps until the process exits, then restore them one by one.

After the fix, process exited — code=0, signal=none appears before the deadline. If the process exits but the port remains open, continue with SC302.