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

profiler: Fix error handling #2318

Merged
merged 1 commit into from
Nov 29, 2023

Conversation

javierhonduco
Copy link
Contributor

The err variable was clobbered so we were reading the wrong value

Test Plan

--- a/pkg/profiler/cpu/bpf/maps/maps.go
+++ b/pkg/profiler/cpu/bpf/maps/maps.go
@@ -1140,6 +1140,7 @@ func (m *Maps) AddUnwindTableForProcess(pid int, executableMappings unwind.Execu
        // is challenging if the process name contains spaces, etc).
        //  - PIDs can be recycled.

+       return fmt.Errorf("le error")
        m.mutex.Lock()
        defer m.mutex.Unlock()

Before:

msg="failed to add unwind table" pid=18846 err=null

After:

msg="failed to add unwind table" pid=18846 err="le err"

The err variable was clobbered so we were reading the wrong value

Test Plan
========

```
--- a/pkg/profiler/cpu/bpf/maps/maps.go
+++ b/pkg/profiler/cpu/bpf/maps/maps.go
@@ -1140,6 +1140,7 @@ func (m *Maps) AddUnwindTableForProcess(pid int, executableMappings unwind.Execu
        // is challenging if the process name contains spaces, etc).
        //  - PIDs can be recycled.

+       return fmt.Errorf("le error")
        m.mutex.Lock()
        defer m.mutex.Unlock()
```

Before:
```
msg="failed to add unwind table" pid=18846 err=null
```

After:
```
msg="failed to add unwind table" pid=18846 err="le err"
``

Signed-off-by: Francisco Javier Honduvilla Coto <[email protected]>
@javierhonduco javierhonduco requested a review from a team as a code owner November 29, 2023 16:21
@javierhonduco
Copy link
Contributor Author

Fixes #2314

@javierhonduco javierhonduco merged commit 961073b into main Nov 29, 2023
21 of 22 checks passed
@javierhonduco javierhonduco deleted the fix-unwind-table-generation-error-handling branch November 29, 2023 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants