chore: handle interpreters with multiple ranges#441
chore: handle interpreters with multiple ranges#441fabled merged 10 commits intoopen-telemetry:mainfrom
Conversation
77a8035 to
d1fc8f3
Compare
|
hehe I think hit the 4.19 kernel insn limit. |
|
|
a498c32 to
42bc6f1
Compare
|
|
||
| func InterpreterOffsetKeyValue(ebpfProgIndex uint16, fileID host.FileID, | ||
| offsetRanges []util.Range) (key uint64, value C.OffsetRange, err error) { | ||
| if len(offsetRanges) != 1 && len(offsetRanges) != 2 { |
There was a problem hiding this comment.
Can we add a comment here (or a few lines later, when we check for len(offetRanges) == 2) clarifying why len(offsetRanges) can be 1 or 2 (I know it's in the eBPF code but it's not obvious here)?
There was a problem hiding this comment.
Thanks. I've updated the comment in the ebpf code and duplicated it into go code.
|
@christos68k Thanks for the review. I will address your comments on Monday. |
Co-authored-by: Christos Kalkanis <christos.kalkanis@elastic.co>
…cold-chunk-fix-part1
Co-authored-by: Christos Kalkanis <christos.kalkanis@elastic.co>
|
@christos68k Thank you for your review
One can test it like this - add an extra range manually diff --git a/interpreter/python/python.go b/interpreter/python/python.go
index 7a1a6cc..1e25e37 100644
--- a/interpreter/python/python.go
+++ b/interpreter/python/python.go
@@ -858,5 +858,6 @@ func findInterpreterRanges(info *interpreter.LoaderInfo) ([]util.Range, error) {
// TODO(korniltsev): find cold ranges
// see tools/coredump/testdata/amd64/alpine320-nobuildid.json
// https://github.com/open-telemetry/opentelemetry-ebpf-profiler/issues/416
+ interpRanges = append(interpRanges, util.Range{Start: 0x8a934, End: 0x8a934 + 56456}) // obtained with readelf from the debug elf
return interpRanges, nil
}I have a proposal branch that recovers cold ranges automatically here main...grafana:opentelemetry-ebpf-profiler:python-interpreter-cold-chunk-fix-part2 |
| if ( | ||
| ((section_offset >= range->lower_offset1) && (section_offset <= range->upper_offset1)) || | ||
| ((section_offset >= range->lower_offset2) && (section_offset <= range->upper_offset2))) { |
There was a problem hiding this comment.
This adds ebpf code and makes it slower. And there's no users for this yet. Could this be commented out? Perhaps also split this out to a function to make this a bit more readable. Then the commented code could be in a #if 0 instead.
There was a problem hiding this comment.
If you anticipate the follow up PR to happen soon, we can already leave this test enabled. Maybe still separate the test to a helper function?
There was a problem hiding this comment.
Extracted to a separate function. I prefer to leave the test enabled.
| var skip = map[string]bool{ | ||
| // https://github.com/open-telemetry/opentelemetry-ebpf-profiler/issues/416 | ||
| "testdata/amd64/alpine320-nobuildid.json": true, | ||
| "testdata/amd64/alpine320.json": true, | ||
| } |
There was a problem hiding this comment.
I'd rather add the skip field to the json file perhaps as a string, where the string is the link to the ticket explaining why it fails.
| @@ -0,0 +1,87 @@ | |||
| { | |||
There was a problem hiding this comment.
perhaps rename the file to python3-alpine320-nobuildid.json or similar to include the interpreter in the name
| @@ -0,0 +1,85 @@ | |||
| { | |||
There was a problem hiding this comment.
rename this too to include python312
Co-authored-by: Timo Teräs <timo.teras@iki.fi>
…cold-chunk-fix-part1
Co-authored-by: Timo Teräs <timo.teras@iki.fi>


alpine:3.20 python3.12 has a separate
_PyEval_EvalFrameDefault_PyEval_EvalFrameDefault.coldreadelf -s -W /usr/lib/debug/usr/lib/libpython3.12.so.1.0.debug | grep EvalFrameDef 2143: 0000000000171780 362 FUNC LOCAL DEFAULT 9 _PyEval_EvalFrameDefault.localalias 2234: 0000000000088a9a 56543 FUNC LOCAL DEFAULT 9 _PyEval_EvalFrameDefault.cold 43791: 0000000000171780 362 FUNC GLOBAL DEFAULT 9 _PyEval_EvalFrameDefaultTherefore ebpf code only assumes the interpreter function is only 362 bytes long and fails to select python unwinder as the meat of the interpreter is in the cold one.
This PR is a second attempt of #414 (comment)
Specifically
This is a preparation for an actual fix of #416 which will be submitted as a followup