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

Use context instead of done channel to avoid RequestCtx race condition #1206

Closed
wants to merge 1 commit into from
Closed

Conversation

moredure
Copy link
Contributor

@moredure moredure commented Feb 3, 2022

Fixes #1205 (propagateCancel will return ok and no goroutine causing race condition won't be created). Truth be told, I don't like the idea of embedding context into the structure: bad practices, etc. But it's seems the only way to fix it, while maintaining requestCtx compatibility with context.Context interface

@moredure moredure changed the title Use context instead of done channel Use context instead of done channel to avoid RequestCtx race condition Feb 3, 2022
@moredure
Copy link
Contributor Author

moredure commented Mar 3, 2022

As @erikdubbelboer found a simpler solution, probably this patch can be used as a solution to not create goroutine per request in cases WithCancel or WithDeadline used on requestCtx.

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.

Panics at on context close, v1.33.0
2 participants