Catch all types of internal error.
Handle session internal errors properly. (Treat as a connection level error.)
Don't stick the heartbeat in timeout_sec, in most cases it will be 0 which we will then treat as meaning "wait 30s before closing on error".