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

otelhttptrace: handle missing getconn hook without panic #5187

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tonistiigi
Copy link
Contributor

We have many reports that end() gets called without the span being defined in start() and causes a panic.

Ref moby/buildkit#4377
Ref docker/buildx#2232

I have not not fully debugged in what condition this happens in stdlib (I assume some keepalive pool case) but I don't see any other possible explanation for these panic cases.

Note that there are other httptrace hooks that also use .root without validation. I don't atm. have any proof that these could be called without GetConn() being called first as well so didn't add extra validation to these.

We have many reports that end() gets called without the
span being defined in start() and causes a panic.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Copy link

codecov bot commented Feb 27, 2024

Codecov Report

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

Project coverage is 61.3%. Comparing base (45226f8) to head (d12420f).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #5187     +/-   ##
=======================================
- Coverage   61.3%   61.3%   -0.1%     
=======================================
  Files        185     185             
  Lines      13883   13887      +4     
=======================================
+ Hits        8512    8513      +1     
- Misses      5171    5173      +2     
- Partials     200     201      +1     
Files Coverage Δ
...on/net/http/httptrace/otelhttptrace/clienttrace.go 78.1% <25.0%> (-0.9%) ⬇️

@dmathieu
Copy link
Member

This change only handles missing span in end() if useSpans is false.
It seems like that could also happen with the use of sub spans as well.

Also, I know this is hard to reproduce, and this package doesn't really have any tests at the moment, but would it be possible to write a test?

@tonistiigi
Copy link
Contributor Author

This change only handles missing span in end() if useSpans is false.
It seems like that could also happen with the use of sub spans as well.

What place/variable do you have in mind?

Also, I know this is hard to reproduce, and this package doesn't really have any tests at the moment, but would it be possible to write a test?

These calls are made from stdlib and I don't know the condition when the specific call order appears.

@pellared
Copy link
Member

These calls are made from stdlib and I don't know the condition when the specific call order appears.

I think the main usage of httptrace.ClientTrace is here: https://github.com/golang/go/blob/master/src/net/http/transport.go

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.

None yet

3 participants