diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-05-13 16:45:20 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-05-17 10:35:20 +0300 |
commit | c8cebd9649e15e9a41d344bb5cea6e1ae1306d19 (patch) | |
tree | b9bb9fffefdf539ae754407d24d49bbc1c9aac68 | |
parent | 6b31501b13eae70aea5061edc8273c551ba4c349 (diff) |
rubyserver: Fix leaking Goroutine when shutting down workers
When stopping the Ruby server, we need to first stop all of the workers.
But because we first stop the worker's monitor before we actually stop
the worker's process we're not consuming the event that is generated on
shutdown of the worker anymore. This leads to a Goroutine leak because
we're blocked waiting for the monitor to consume the event, but that's
never going to happen.
Fix this Goroutine leak by first stopping the process, and only stopping
the monitor after that to ensure the event can still be read. This is in
preparation for a set of tests we're going to add in the Ruby server
which would otherwise trigger this leak.
-rw-r--r-- | internal/gitaly/rubyserver/rubyserver.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/gitaly/rubyserver/rubyserver.go b/internal/gitaly/rubyserver/rubyserver.go index 8db9c500d..125377514 100644 --- a/internal/gitaly/rubyserver/rubyserver.go +++ b/internal/gitaly/rubyserver/rubyserver.go @@ -117,8 +117,8 @@ func (s *Server) Stop() { } for _, w := range s.workers { - w.stopMonitor() w.Process.Stop() + w.stopMonitor() } } } |