Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug/elf: elf.Open() leaks fds #5714

Closed
davecheney opened this issue Jun 16, 2013 · 4 comments
Closed

debug/elf: elf.Open() leaks fds #5714

davecheney opened this issue Jun 16, 2013 · 4 comments

Comments

@davecheney
Copy link
Contributor

Investigating another issue I found that debug/elf.Open returns a type that cannot be
closed, resulting in a file descriptor leak.

goroutine 1 [running]:
os.NewFile(0x3, 0x1053bf00, 0x28, 0x0)
        /home/dfc/go/src/pkg/os/file_unix.go:49 +0x100
os.OpenFile(0x1053bf00, 0x28, 0x0, 0x0, 0x63bb8, ...)
        /home/dfc/go/src/pkg/os/file_unix.go:97 +0x128
os.Open(0x1053bf00, 0x28, 0x2, 0x0, 0x0, ...)
        /home/dfc/go/src/pkg/os/file.go:230 +0x50
debug/elf.Open(0x1053bf00, 0x28, 0x21, 0x183f88, 0x7, ...)
        /home/dfc/go/src/pkg/debug/elf/file.go:152 +0x30
main.(*Package).gccDebug(0x105123f0, 0x10553c00, 0x2fb, 0x36e, 0x0, ...)
        /home/dfc/go/src/cmd/cgo/gcc.go:744 +0x514
main.(*Package).loadDWARF(0x105123f0, 0x1050a1c0, 0x10557330, 0x4, 0x4, ...)
        /home/dfc/go/src/cmd/cgo/gcc.go:434 +0x800
main.(*Package).Translate(0x105123f0, 0x1050a1c0)
        /home/dfc/go/src/cmd/cgo/gcc.go:180 +0x140
main.main()
        /home/dfc/go/src/cmd/cgo/main.go:226 +0xd40
****

panic: leaked!

goroutine 15 [running]:
os.(*file).whinge(0x1054ece0)
        /home/dfc/go/src/pkg/os/file_unix.go:108 +0x104
@remyoudompheng
Copy link
Contributor

Comment 2:

I'm not sure what this is about. *elf.File can certainly be closed. Instead are you
saying that cgo code is buggy and should close files?

@davecheney
Copy link
Contributor Author

Comment 3:

elf (and it's friends) don't call close. Obviously I missed that there was a close
method. I'll take a look again.

Labels changed: added priority-later, removed priority-triage.

Owner changed to @davecheney.

@davecheney
Copy link
Contributor Author

Comment 4:

https://golang.org/cl/10386043

Status changed to Started.

@davecheney
Copy link
Contributor Author

Comment 5:

This issue was closed by revision f9c22f7.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants