Fixed leakage of DB TCP connections.
Tolerate DB restarts.