Skip to content

Fix deadlock in host shutdown

Christopher Schinnerl requested to merge vw-host-clean-close into master

Created by: VoidingWarranties

The first commit in this PR fixes the deadlock. The rest of the commits are suggestions. I ask that you evaluate them individually.

The deadlock was possible because it was possible for the listener to start before the host is closed, but for the closer-goroutine to start after the host is closed. This is fixed by calling Add outside of the goroutine. The exact same deadlock existed in the gateway in #1178. Add should always be called outside of the goroutine when starting a closer-goroutine.

Merge request reports