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

Deadlock in http.Client #994

Closed
AyWa opened this issue Jul 29, 2021 · 4 comments · Fixed by #997
Closed

Deadlock in http.Client #994

AyWa opened this issue Jul 29, 2021 · 4 comments · Fixed by #997
Labels
agent-go bug Something isn't working

Comments

@AyWa
Copy link

AyWa commented Jul 29, 2021

versions

  • go version go1.16.3 darwin/amd64
  • go.elastic.co/apm v1.12.0
  • go.elastic.co/apm/module/apmhttp v1.12.0

Bug

When the default http client is wrap with apmhttp.WrapClient(http.DefaultClient, apmhttp.WithClientTrace()) there is some case where an http request, will never answer. Even if the request has a context deadline.

To Reproduce

It is little hard to reproduce so I made code to reproduce it: https://github.com/AyWa/goapmdeadlock
I guess the scenario is like that:

Expected behavior

The http.Client should not be in deadlock when wrap by apmhttp ( I think the deadlock happen for a given trace id so new request might work fine)

@axw
Copy link
Member

axw commented Jul 30, 2021

@AyWa thank you for the detailed issue and reproducer - I can reproduce the issue with your program. I haven't gotten to the bottom of it yet, but it appears to be related to the use of apmhttp.WithClientTrace(). At least, when I remove just that option it no longer reproduces.

@axw axw added the bug Something isn't working label Jul 30, 2021
@axw axw mentioned this issue Aug 5, 2021
@axw
Copy link
Member

axw commented Aug 5, 2021

Sorry for the delay in getting back to you. I've found a couple of different concurrency bugs, both of which are addressed in #997.

@axw axw closed this as completed in #997 Aug 5, 2021
@axw
Copy link
Member

axw commented Aug 5, 2021

@AyWa we've just released v1.13.1 that should fix this issue. Please upgrade and let us know how it goes.

@AyWa
Copy link
Author

AyWa commented Aug 9, 2021

@axw Thank you a lot for the quick fix. I will try it soon -> I can not reproduce it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-go bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants