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

[ISSUE #698] fix: call cancel() as soon as possible to release the resources associatd with context #691

Merged
merged 1 commit into from
Jul 6, 2021

Conversation

fengberlin
Copy link
Contributor

Although the the resources associatd with the context created by context.WithTimeout will be release after the timer elapsed, but call cancel() to release the resources as soon as possible can avoid context/memory leak.

@codecov-commenter
Copy link

codecov-commenter commented Jun 29, 2021

Codecov Report

Merging #691 (506e50e) into master (c688c19) will increase coverage by 0.02%.
The diff coverage is 35.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #691      +/-   ##
==========================================
+ Coverage   24.71%   24.74%   +0.02%     
==========================================
  Files          48       48              
  Lines        5223     5234      +11     
==========================================
+ Hits         1291     1295       +4     
- Misses       3726     3733       +7     
  Partials      206      206              
Impacted Files Coverage Δ
internal/client.go 0.00% <0.00%> (ø)
internal/trace.go 29.49% <0.00%> (-0.11%) ⬇️
internal/route.go 9.86% <100.00%> (+0.61%) ⬆️
producer/producer.go 28.57% <100.00%> (+0.44%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c688c19...506e50e. Read the comment docs.

@wenfengwang
Copy link
Member

wenfengwang commented Jul 1, 2021

It seems that the changes of this PR included in #692

could you separate them or close this PR?

@fengberlin

@wenfengwang wenfengwang added the duplicate This issue or pull request already exists label Jul 1, 2021
@fengberlin
Copy link
Contributor Author

ok. I will separate them in #692. Could you accept this PR first?
@wenfengwang

@fengberlin
Copy link
Contributor Author

this PR can be remove the duplicate label?
@wenfengwang

@fengberlin
Copy link
Contributor Author

fengberlin commented Jul 5, 2021

Please continue reviewing my PR. Thanks.
@wenfengwang

@wenfengwang wenfengwang added enhancement New feature or request and removed duplicate This issue or pull request already exists labels Jul 5, 2021
@wenfengwang
Copy link
Member

LGTM @ding @maixiaohai

@maixiaohai
Copy link
Contributor

@fengberlin plz create a related issue~

@fengberlin
Copy link
Contributor Author

@fengberlin plz create a related issue~

I have been created the issue #698 related to this PR.
Plz continue review my PR. Thanks.
@maixiaohai

@fengberlin fengberlin changed the title fix: call cancel() as soon as possible to release the resources associatd with context [ISSUE #698] fix: call cancel() as soon as possible to release the resources associatd with context Jul 5, 2021
@maixiaohai maixiaohai linked an issue Jul 5, 2021 that may be closed by this pull request
@maixiaohai maixiaohai merged commit 8612bf7 into apache:master Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The cancel function created by context.WithTimeout should be called
4 participants