add master connect agent exception contronl and add tasks deal with func to thread