Package: gitlab
Version: 8.13.6+dfsg1-2
Severity: normal

Dear Maintainer,

The current systemd service file for gitlab-sidekiq contains a hack to delay the systemd service startup until sidekiq is actually ready by sleeping for up to 32 seconds (in increments of 4 seconds) until sidekiq's cmdline changes.

Besides being an unpleasant hack, and potentially ending too early (e.g. if sidekiq takes more than 32 seconds to start up on a slow/loaded machine), this also has the unfortunate consequence of showing this command forever in the service status output, and of making the service take up to 4 seconds longer than necessary to actually be registered as started.

We can do much better by performing a proper systemd notify, as follows (I've tested this locally, and it works properly):


1. Patch the installed /etc/gitlab/initializers/sidekiq.rb to add, near the top of the configure_server function:


  if ((socket_path = ENV["NOTIFY_SOCKET"]))
    config.on(:startup) do
      notify_socket = Socket.new(Socket::AF_UNIX, Socket::SOCK_DGRAM, 0)
      notify_socket.connect(Socket.sockaddr_un(socket_path))
      notify_socket.sendmsg "READY=1", Socket::MSG_NOSIGNAL
    end
  end


2. change the gitlab-sidekiq.service file to contain:

Type=notify

and delete the ExecStartPost= line.



Then we get proper notification support: notification happens immediately upon sidekiq being ready, the hack is gone, and the job starts faster.


Jason Rhinelander

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to