From d8569440b5008f9cd383515d5dce3bf8730bbef6 Mon Sep 17 00:00:00 2001 From: Sebastian Reitenbach Date: Sun, 26 Mar 2017 08:58:49 +0200 Subject: [PATCH] There might be ps utilities out there, that assume 80chars instead of unlimited width if they cannot detect terminal size, therefore force unlimited terminal size when checking processes via ps. --- app/controllers/admin/background_jobs_controller.rb | 2 +- changelogs/unreleased/fix_rake_gitlab_check_sidekiq.yml | 4 ++++ lib/tasks/gitlab/check.rake | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 changelogs/unreleased/fix_rake_gitlab_check_sidekiq.yml diff --git a/app/controllers/admin/background_jobs_controller.rb b/app/controllers/admin/background_jobs_controller.rb index c09095b9849..87eb7ff4c93 100644 --- a/app/controllers/admin/background_jobs_controller.rb +++ b/app/controllers/admin/background_jobs_controller.rb @@ -1,6 +1,6 @@ class Admin::BackgroundJobsController < Admin::ApplicationController def show - ps_output, _ = Gitlab::Popen.popen(%W(ps -U #{Gitlab.config.gitlab.user} -o pid,pcpu,pmem,stat,start,command)) + ps_output, _ = Gitlab::Popen.popen(%W(ps ww -U #{Gitlab.config.gitlab.user} -o pid,pcpu,pmem,stat,start,command)) @sidekiq_processes = ps_output.split("\n").grep(/sidekiq/) @concurrency = Sidekiq.options[:concurrency] end diff --git a/changelogs/unreleased/fix_rake_gitlab_check_sidekiq.yml b/changelogs/unreleased/fix_rake_gitlab_check_sidekiq.yml new file mode 100644 index 00000000000..4752ed34ae6 --- /dev/null +++ b/changelogs/unreleased/fix_rake_gitlab_check_sidekiq.yml @@ -0,0 +1,4 @@ +--- +title: Force unlimited terminal size when checking processes via call to ps +merge_request: 10246 +author: Sebastian Reitenbach diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index a6f8c4ced5d..a9a48f7188f 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -617,7 +617,7 @@ namespace :gitlab do end def sidekiq_process_count - ps_ux, _ = Gitlab::Popen.popen(%w(ps ux)) + ps_ux, _ = Gitlab::Popen.popen(%w(ps uxww)) ps_ux.scan(/sidekiq \d+\.\d+\.\d+/).count end end @@ -751,7 +751,7 @@ namespace :gitlab do end def mail_room_running? - ps_ux, _ = Gitlab::Popen.popen(%w(ps ux)) + ps_ux, _ = Gitlab::Popen.popen(%w(ps uxww)) ps_ux.include?("mail_room") end end