Hello. I suspect that there is a bug in vsock package (or could be I'm missing some thing).
It looks like Accept remains blocked after listener is closed (and should immediately return an error instead).
Here is an example:
package main
import (
"log"
"sync"
"time"
"github.com/mdlayher/vsock"
)
func main() {
listener, err := vsock.Listen(1024)
if err != nil {
panic(err)
}
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
log.Print("before accept")
_, err := listener.Accept()
log.Printf("accept error: %v", err)
}()
time.Sleep(1*time.Second)
log.Print("closing listener")
err = listener.Close()
if err != nil {
log.Printf("close error: %v", err)
}
log.Print("waiting")
wg.Wait()
// Never happens because Accept never unblocks
log.Print("exiting")
}
Hello. I suspect that there is a bug in
vsock
package (or could be I'm missing some thing). It looks likeAccept
remains blocked after listener is closed (and should immediately return an error instead). Here is an example:And the output is:
I was able to reproduce this on 2 machines:
There is similar issue https://github.com/mdlayher/vsock/issues/13 but the fix is not working on
go1.11.1
.Thanks!
CC @samuelkarp