containerd / ttrpc-rust

Rust implementation of ttrpc (GRPC for low-memory environments)
Apache License 2.0
195 stars 45 forks source link

server: fix the issue of potenial deadlock and connections leak #30

Closed lifupan closed 4 years ago

lifupan commented 4 years ago

It's better to lock on the connections when do shutdown, otherwise the connections lock would be taken first by the server main thread and wait on child connections thread exit, but since the shutdown couldn't take the connections lock to close the connections, this would cause a deak lock.

BTW, when a connection closed and the dealing thread exit, remove the connection from the server's hashmap.

Signed-off-by: fupan.lfp fupan.lfp@antfin.com