summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-03-30 01:20:32 -0700
committerStan Hu <stanhu@gmail.com>2018-03-30 01:23:57 -0700
commitcc82abbde0c8994a64183f4d7250966b3d462b66 (patch)
tree319715a1a85d582e1130d44f8db40b94678cbe6f
parent9b76d8512a5491202e5a953950cc815be9536648 (diff)
downloadgitlab-ce-sh-cleanup-pages-worker.tar.gz
Free open file descriptors and libgit2 buffers in UpdatePagesServicesh-cleanup-pages-worker
In UpdatePagesService, we were seeing a large number of open pack files in production. Calling Project#cleanup removes a reference to Rugged::Repository and forces libgit2 to close file descriptors and free its internal memory cache. Relates to https://gitlab.com/gitlab-com/infrastructure/issues/3965#note_65837525
-rw-r--r--app/services/projects/update_pages_service.rb3
-rw-r--r--changelogs/unreleased/sh-cleanup-pages-worker.yml5
2 files changed, 8 insertions, 0 deletions
diff --git a/app/services/projects/update_pages_service.rb b/app/services/projects/update_pages_service.rb
index 5bf8208e035..9c8877be14e 100644
--- a/app/services/projects/update_pages_service.rb
+++ b/app/services/projects/update_pages_service.rb
@@ -178,6 +178,9 @@ module Projects
def latest_sha
project.commit(build.ref).try(:sha).to_s
+ ensure
+ # Close any file descriptors that were opened and free libgit2 buffers
+ project.cleanup
end
def sha
diff --git a/changelogs/unreleased/sh-cleanup-pages-worker.yml b/changelogs/unreleased/sh-cleanup-pages-worker.yml
new file mode 100644
index 00000000000..c26e1342dd2
--- /dev/null
+++ b/changelogs/unreleased/sh-cleanup-pages-worker.yml
@@ -0,0 +1,5 @@
+---
+title: Free open file descriptors and libgit2 buffers in UpdatePagesService
+merge_request:
+author:
+type: performance