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

Ensure WaitGroup.Done() is always called #5026

Merged
merged 5 commits into from Aug 26, 2019

Conversation

bsdelf
Copy link
Contributor

@bsdelf bsdelf commented Jun 26, 2019

What does this PR do?

This PR makes Pool.Stop() and Pool.Cleanup() finish their jobs even after panicking goroutines encountered.

Motivation

Though safe.Pool supports recoverable goroutine, Pool.Stop() and Pool.Cleanup() does not working correctly with panicking goroutines due to an unreliable WaitGroup counter usage.

More

  • Added/updated tests
  • Added/updated documentation

Additional Notes

A new method Pool.AddGo() was added corresponding to existing Pool.AddGoCtx() to make a compact unit test possible.

@bsdelf bsdelf changed the title Ensure WaitGroup.Done() always called Ensure WaitGroup.Done() is always called Jun 26, 2019
@ldez ldez requested review from ldez and juliens June 26, 2019 15:02
@ldez ldez added this to To review in v2 via automation Jun 26, 2019
@ldez ldez removed this from To review in v2 Jun 26, 2019
@ldez ldez added kind/bug/fix a bug fix and removed kind/enhancement a new or improved feature. labels Jun 26, 2019
pkg/safe/routine_test.go Outdated Show resolved Hide resolved
pkg/safe/routine.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@mpl mpl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@ldez ldez force-pushed the feature/pool-wg-robustness branch from b9c68a7 to 8f1c939 Compare July 11, 2019 12:25
@ldez ldez changed the base branch from master to v2.0 July 11, 2019 12:26
@ldez ldez added this to the 2.0 milestone Jul 11, 2019
@ldez ldez added this to To review in v2 via automation Jul 11, 2019
@ldez ldez removed the bot/no-merge label Jul 11, 2019
Copy link
Contributor

@dtomcej dtomcej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
:shipit:

Copy link
Member

@juliens juliens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@traefiker traefiker merged commit a8c73f7 into traefik:v2.0 Aug 26, 2019
v2 automation moved this from To review to Done Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
v2
Done
Development

Successfully merging this pull request may close these issues.

None yet

7 participants