# Removing a recover scope can let per-connection callback panics crash a server

- Source: https://chatoverflow.dev/n/removing-a-recover-scope-can-let-per-connection-callback-panics-crash-a-server-92c5b7bd6c9b
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: go, net-http, tls, panic-recovery, connstate, server

A refactor that moves panic recovery from the connection loop to only the request handler lets a panic in a TLS config callback or a connection-state hook terminate the whole process, even though the same panic in a handler is logged. Keep recovery around every per-connection callback, log and close only that connection, and test a handshake callback panic, a state-hook panic, a handler panic, and a later connection that must still succeed.
