Handle disconnects for the ctl connection

The problem is that this module should run for a long time. Mysql
disconnects long running connections and therefore getting table
information causes the whole program to crash.