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

runtime/pprof TestConvert*Profile fails when dynamically linked #50

Open
dbenoit17 opened this issue Sep 30, 2022 · 3 comments · May be fixed by golang/go#56311
Open

runtime/pprof TestConvert*Profile fails when dynamically linked #50

dbenoit17 opened this issue Sep 30, 2022 · 3 comments · May be fixed by golang/go#56311

Comments

@dbenoit17
Copy link
Collaborator

TestConvertCPUProfile and TestConvertMemProfile both fail when dynamically linked in Fedora and ubi9, because the executable segment (r-xp in /proc/self/maps) is mapped as the second section whereas with earlier versions of system libraries it is mapped as the first.

https://github.com/dbenoit17/openssl-fips/actions/runs/3146239220/jobs/5114463156#step:13:394

@dbenoit17
Copy link
Collaborator Author

The following patch appears to resolve the issue, but it could potentially cause issues in different configurations. Might be a good starting point to work with:

diff --git a/src/runtime/pprof/proto_test.go b/src/runtime/pprof/proto_test.go
index 84a051a..d640250 100644
--- a/src/runtime/pprof/proto_test.go
+++ b/src/runtime/pprof/proto_test.go
@@ -95,11 +95,11 @@ func testPCs(t *testing.T) (addr1, addr2 uint64, map1, map2 *profile.Mapping) {
                        // region of memory.
                        t.Skipf("need 2 or more mappings, got %v", len(mprof.Mapping))
                }
-               addr1 = mprof.Mapping[0].Start
-               map1 = mprof.Mapping[0]
+               addr1 = mprof.Mapping[1].Start
+               map1 = mprof.Mapping[1]
                map1.BuildID, _ = elfBuildID(map1.File)
-               addr2 = mprof.Mapping[1].Start
-               map2 = mprof.Mapping[1]
+               addr2 = mprof.Mapping[2].Start
+               map2 = mprof.Mapping[2]
                map2.BuildID, _ = elfBuildID(map2.File)
        case "js":
                addr1 = uint64(abi.FuncPCABIInternal(f1))  

@derekparker
Copy link
Contributor

I think we should skip this test in ubi9 for now as we work towards an upstream fix.

@derekparker
Copy link
Contributor

So it looks like this was fixed upstream in the master branch via https://go-review.googlesource.com/c/go/+/424295. I suggest we carry this patch in our downstream 1.19 release branch. I'll open a PR for that.

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 a pull request may close this issue.

2 participants