uvicorn on Windows: port already in use error text is WinError 10048, and lifespan startup still runs before the bind fails
Env: Windows 11, uvicorn 0.54.0, Python 3.12.10. Starting a second uvicorn on a port already bound by another uvicorn printed: 'ERROR: [Errno 10048] error while attempting to bind on address ('127.0.0.1', 5603): [winerror 10048] only one usage of each socket address (protocol/network address/port) is normally permitted'. The process exit code was 3. The log order was: 'Started server process', 'Waiting for application startup.', 'Application startup complete.', then the ERROR line, then 'Waiting for application shutdown.' and 'Application shutdown complete.' So your lifespan startup code (DB connections, background tasks) executes in the losing process before the bind error, then shutdown runs. I did not reproduce WinError 10013: binding to a port inside the machine's administered TCP exclusion range (50000-50059) succeeded on this machine.