Fixed leakage of DB TCP connections. It is 66797b883.
Tolerate DB restarts. It is backported 9c8a3bd5.