Skip to content

Conversation

@boekkooi-impossiblecloud
Copy link
Contributor

Good day,

During our peak hours we have noticed the following invalid memory address or nil pointer dereference which causes pod restarts. The goal of this PR is to avoid these panics.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x142d033]

goroutine 6941 [running]:
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace.(*clientTracer).got100Continue(0x0?)
        /app/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace/clienttrace.go:363 +0x33
net/http.(*persistConn).readResponse(0xc004acea20, {{}, 0xc00c31e370, 0xc006d058f0, 0x0, 0xc006d05810, 0xc006d05880}, 0xc006893100)
        /usr/local/go/src/net/http/transport.go:2470 +0xfd
net/http.(*persistConn).readLoop(0xc004acea20)
        /usr/local/go/src/net/http/transport.go:2290 +0x2a6
created by net/http.(*Transport).dialConn in goroutine 6933
        /usr/local/go/src/net/http/transport.go:1944 +0x172f

Thanks for reviewing and let me know what you think.
Have a great day!

@boekkooi-impossiblecloud boekkooi-impossiblecloud marked this pull request as draft June 12, 2025 09:29
@boekkooi-impossiblecloud boekkooi-impossiblecloud force-pushed the boekkooi/ClientTrace-panic branch 2 times, most recently from 379ae76 to b029aa7 Compare June 12, 2025 09:53
@boekkooi-impossiblecloud boekkooi-impossiblecloud marked this pull request as ready for review June 12, 2025 10:38
@pellared pellared added this to the v1.37.0 milestone Jun 12, 2025
@dmathieu
Copy link
Member

Would it make sense to use a noop span instead ?

@boekkooi-impossiblecloud
Copy link
Contributor Author

boekkooi-impossiblecloud commented Jun 12, 2025

@dmathieu I tried that first but that makes the if statements (in wroteHeaders and wroteHeaderField) that currently check for nil harder, so I went for sticking to the existing method of checking for nil

@codecov
Copy link

codecov bot commented Jun 13, 2025

Codecov Report

Attention: Patch coverage is 25.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 81.5%. Comparing base (a39bd91) to head (5be7225).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...on/net/http/httptrace/otelhttptrace/clienttrace.go 25.0% 7 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #7464   +/-   ##
=====================================
  Coverage   81.4%   81.5%           
=====================================
  Files        198     198           
  Lines      17946   17952    +6     
=====================================
+ Hits       14621   14634   +13     
+ Misses      2927    2918    -9     
- Partials     398     400    +2     
Files with missing lines Coverage Δ
...on/net/http/httptrace/otelhttptrace/clienttrace.go 82.8% <25.0%> (+3.2%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

pellared
pellared previously approved these changes Jun 13, 2025
Copy link
Member

@pellared pellared left a comment

Choose a reason for hiding this comment

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

Can you please resolve the conflict?

@boekkooi-impossiblecloud boekkooi-impossiblecloud force-pushed the boekkooi/ClientTrace-panic branch 3 times, most recently from 1b508ca to 5e894f9 Compare June 13, 2025 08:13
@boekkooi-impossiblecloud
Copy link
Contributor Author

@pellared Sorry I had to rebase (and I squashed the changes as coffee detox made me fetch the wrong remote 🙈)

@pellared pellared self-requested a review June 13, 2025 08:23
@pellared pellared dismissed their stale review June 13, 2025 08:23

Need to review again.

@boekkooi-impossiblecloud
Copy link
Contributor Author

Thanks @pellared and @dmathieu for reviewing and sorry for the back and forth on this one.

@pellared
Copy link
Member

Thanks @pellared and @dmathieu for reviewing and sorry for the back and forth on this one.

Everything is fine. Thanks a lot for your contribution! ❤️

@dmathieu dmathieu merged commit 46530a2 into open-telemetry:main Jun 16, 2025
26 of 27 checks passed
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.

3 participants