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

Do not memoize system-probe sock path error #32728

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pkg/process/net/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ var _ SysProbeUtilGetter = GetRemoteSystemProbeUtil

// GetRemoteSystemProbeUtil returns a ready to use RemoteSysProbeUtil. It is backed by a shared singleton.
func GetRemoteSystemProbeUtil(path string) (SysProbeUtil, error) {
err := CheckPath(path)
if err != nil {
return nil, fmt.Errorf("error setting up remote system probe util, %v", err)
}

sysProbeUtil, err := getRemoteSystemProbeUtil(path)
if err != nil {
return nil, err
Expand All @@ -79,13 +84,8 @@ func GetRemoteSystemProbeUtil(path string) (SysProbeUtil, error) {
}

var getRemoteSystemProbeUtil = funcs.MemoizeArg(func(path string) (*RemoteSysProbeUtil, error) {
err := CheckPath(path)
if err != nil {
return nil, fmt.Errorf("error setting up remote system probe util, %v", err)
}

sysProbeUtil := newSystemProbe(path)
err = sysProbeUtil.initRetry.SetupRetrier(&retry.Config{ //nolint:errcheck
err := sysProbeUtil.initRetry.SetupRetrier(&retry.Config{ //nolint:errcheck
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we get an error (a temporary error) here, we will still memoize it
I don't think the memoize is a good idea here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error returning from this function is just for configuration issues of the retrier https://github.com/DataDog/datadog-agent/blob/7.61.x/pkg/util/retry/retrier.go#L30

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And before the PR this was done in a sync.Once and the error was ignored: https://github.com/DataDog/datadog-agent/blob/7.60.1/pkg/process/net/common.go#L78-L88

Name: "system-probe-util",
AttemptMethod: sysProbeUtil.init,
Strategy: retry.RetryCount,
Expand Down
Loading