Skip to content

runtime: probably excessive garbage collection on objects using finalizer #14910

Closed
@mikioh

Description

@mikioh

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    tip through go1.4
  2. What operating system and processor architecture are you using (go env)?
    {dragonfly,freebsd,linux,openbsd,netbsd}/amd64
  3. 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()
        }
}
  1. What did you expect to see?
    no error output
  2. What did you see instead?
0 0
1 0
[...]
bad file descriptor

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions