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

Prevent timer leaks in Workerpool and others (#11333) #11340

Merged
merged 1 commit into from
May 8, 2020

Conversation

zeripath
Copy link
Contributor

@zeripath zeripath commented May 8, 2020

There is a potential memory leak in Workerpool due to the intricacies of
time.Timer stopping.

Whenever a time.Timer is Stopped its channel must be cleared using a
select if the result of the Stop() is false.

Unfortunately in Workerpool these were checked the wrong way round.

However, there were a few other places that were not being checked.

Signed-off-by: Andrew Thornton art27@cantab.net

Co-authored-by: techknowlogick techknowlogick@gitea.io
Co-authored-by: Lunny Xiao xiaolunwen@gmail.com

There is a potential memory leak in `Workerpool` due to the intricacies of
`time.Timer` stopping.

Whenever a `time.Timer` is `Stop`ped its channel must be cleared using a
`select` if the result of the `Stop()` is `false`.

Unfortunately in `Workerpool` these were checked the wrong way round.

However, there were a few other places that were not being checked.

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@zeripath zeripath added this to the 1.11.5 milestone May 8, 2020
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label May 8, 2020
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 8, 2020
@lunny lunny merged commit 86863ae into go-gitea:release/v1.11 May 8, 2020
@zeripath zeripath deleted the backport-11333 branch May 8, 2020 16:50
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants