fixed the bug that the server resources cannot be cleaned if the socket server fail to start