- 
                Notifications
    You must be signed in to change notification settings 
- Fork 18.4k
Closed
Labels
Description
Please answer these questions before submitting your issue. Thanks!
- What version of Go are you using (go version)?
 tip through go1.4
- What operating system and processor architecture are you using (go env)?
 {dragonfly,freebsd,linux,openbsd,netbsd}/amd64
- What did you do?
 ran the following snippet:
package main
import (
        "fmt"
        "net"
        "runtime"
        "syscall"
)
func main() {
        c, err := net.ListenPacket("udp4", "0.0.0.0:0")
        if err != nil {
                fmt.Println(err)
                return
        }
        f, err := c.(*net.UDPConn).File()
        c.Close()
        if err != nil {
                fmt.Println(err)
                return
        }
        //defer f.Close()
        s := int(f.Fd())
        for i := 0; ; i++ {
                soerr, err := syscall.GetsockoptInt(s, syscall.SOL_SOCKET, syscall.SO_ERROR)
                if err != nil {
                        fmt.Println(err)
                        return
                }
                fmt.Println(i, soerr)
                runtime.GC()
        }
}
- What did you expect to see?
 no error output
- What did you see instead?
0 0
1 0
[...]
bad file descriptor