Skip to content

Commit

Permalink
Reset the /proc offset after a failed attempt to find pid (#681)
Browse files Browse the repository at this point in the history
* Reset the /proc offset after a failed attempt to fiind pid

* Update changelog
  • Loading branch information
RonFed committed Feb 20, 2024
1 parent cf25487 commit cf4ecc3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ OpenTelemetry Go Automatic Instrumentation adheres to [Semantic Versioning](http
- Close `proc` file when done discovering PID. ([#649](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/649))
- Use `debug` packages to parse Go and modules' versions. ([#653](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/653))
- Clean up warn in otelglobal `SetStatus()` when grabbing the status code. ([#675](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/675))
- Reset `proc` offset after a failed iteration. ([#681](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/681))
- Avoid using runtime.NumCPU to get the number of CPUs on the system before remote mmap ([#680](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/680))

## [v0.10.1-alpha] - 2024-01-10
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/process/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ func (a *Analyzer) DiscoverProcessID(target *TargetArgs) (int, error) {
} else {
a.logger.Error(err, "error while searching for process", "exe_path", target.ExePath)
}

// Reset the file offset for next iteration
_, err = proc.Seek(0, 0)
if err != nil {
return 0, err
}
}
}
}
Expand Down

0 comments on commit cf4ecc3

Please sign in to comment.