Production applications should close resources cleanly when receiving shutdown signals. A graceful shutdown can stop accepting new work and allow active requests to finish.
This reduces dropped requests and helps close database or network resources safely.
Deep dive
Signals
Process managers and hosting platforms can send signals such as SIGTERM when a process should stop. Your application should use this opportunity to close the HTTP server and release resources.
Shutdown timeout
In production, consider a maximum shutdown window so a stuck request cannot keep the process alive forever.