Skip to content

possible generic netlink socket leak #3126

New issue

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

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

Already on GitHub? # to your account

Open
iampastor opened this issue Jun 7, 2022 · 0 comments
Open

possible generic netlink socket leak #3126

iampastor opened this issue Jun 7, 2022 · 0 comments

Comments

@iampastor
Copy link

code at this line https://github.com/google/cadvisor/blob/v0.44.1/utils/cpuload/netlink/reader.go#L38

func New() (*NetlinkReader, error) {
	conn, err := newConnection()
	if err != nil {
		return nil, fmt.Errorf("failed to create a new connection: %s", err)
	}

	id, err := getFamilyID(conn)
	if err != nil {
                // if this err happend, conn should be closed
		return nil, fmt.Errorf("failed to get netlink family id for task stats: %s", err)
	}
	klog.V(4).Infof("Family id for taskstats: %d", id)
	return &NetlinkReader{
		familyID: id,
		conn:     conn,
	}, nil
}

conn should be closed when getFamilyID return error, because socket already been created, if not close, this socket will keep in memory, let process holds a lot of fds.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant