Skip to content

Ensure Workhorse log writers are closed to avoid Goroutine leaks

Stan Hu requested to merge sh-close-logwriter-workhorse into master

What does this MR do and why?

We've seen in production the number of Goroutines in Workhorse exceed 4000. The pprof output suggests that many of these came from the logrus Goroutines lingering.

When Workhorse forks gitlab-zip-cat and gitlab-zip-metadata it attempts to log all stderr via a logrus Writer. logrus launches a Goroutine to listen from a pipe. We should ensure this Writer is closed so that the Goroutines shut down as soon as possible.

Relates to https://gitlab.com/gitlab-com/gl-infra/capacity-planning-trackers/gitlab-com/-/issues/1796#note_1951751255

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Stan Hu

Merge request reports