fixed deadlock of socket descriptors