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

sync.Pool should be passed by reference #614

Merged
merged 1 commit into from
May 6, 2022

Conversation

sodaRyCN
Copy link
Contributor

@sodaRyCN sodaRyCN commented May 5, 2022

The sync.Pool used in filter/proxy/pool.go should be passed by reference instead of by value.
use go vet command go vet pkg/filter/proxy/*.go , then get the warnings.

note: objects in sync.Pool that are not explicitly cleaned up before call Put may cause dirty data to be obtained the next time call Get. I'm guessing httpStatResultPool might be the case, but I need experiments to prove it. EG:When the first request succeeds, httpstat.Result's some properties will be set, and when the second request fails (failed to resolve the domain name, failed to establish a tcp link and etc.), some properties (NameLookup\TLSHandshake\serverDone) may use the last one. value,that may be leads to a bias in the statistics

@localvar
Copy link
Collaborator

localvar commented May 6, 2022

Thanks, I think this PR fixes an important bug.

@suchen-sci suchen-sci merged commit 2845b76 into easegress-io:main May 6, 2022
@sodaRyCN sodaRyCN deleted the fix_sync_pool_copy branch June 9, 2022 12:39
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