Skip to content

Canceling jobs in shell executor doesnt work

Summary

When using GitLab runner shell executor, canceled jobs from GitLab web interface still running and it is not possible to run new jobs. In my case, I have problem with running packer.

Steps to reproduce

  • Use shell executor
  • Run packer build
  • Cancel job from GitLab web interface

Actual behavior

  • Running proces are moved under systemd PID 1 and still running

Expected behavior

  • Signal is send to all process and are gracefully killed

Relevant logs and/or screenshots

The problem is, that Gitlab runner tries to kill process group (see https://gitlab.com/gitlab-org/gitlab-runner/blob/master/helpers/process_group_unix.go#L17), but just su has this process group (see first column from htop).

gitlab-bug

So after cancelling job, just su process is killed and all child processes are moved under PID 1.

Environment description

  • Custom installation
  • Centos 7.4
  • Executor: shell

Used GitLab Runner version

# gitlab-runner --version
Version:      10.4.0
Git revision: 857480b6
Git branch:   10-4-stable
GO version:   go1.8.5
Built:        Mon, 22 Jan 2018 09:47:33 +0000
OS/Arch:      linux/amd64