Skip to content

sudo kill called with invalid signal #9202

@phill84

Description

@phill84

Apache Airflow version:
1.10.9 until the current master (f4faed6)

Environment
python3.6

What happened:
airflow fails to kill tasks executed with sudo

Traceback (most recent call last):
  File "/opt/airflow/.venv/bin/airflow", line 37, in <module>
    args.func(args)
  File "/opt/airflow/.venv/lib/python3.6/site-packages/airflow/utils/cli.py", line 75, in wrapper
    return f(*args, **kwargs)
  File "/opt/airflow/.venv/lib/python3.6/site-packages/airflow/bin/cli.py", line 545, in run
    _run(args, dag, ti)
  File "/opt/airflow/.venv/lib/python3.6/site-packages/airflow/bin/cli.py", line 460, in _run
    run_job.run()
  File "/opt/airflow/.venv/lib/python3.6/site-packages/airflow/jobs/base_job.py", line 221, in run
    self._execute()
  File "/opt/airflow/.venv/lib/python3.6/site-packages/airflow/jobs/local_task_job.py", line 127, in _execute
    self.on_kill()
  File "/opt/airflow/.venv/lib/python3.6/site-packages/airflow/jobs/local_task_job.py", line 130, in on_kill
    self.task_runner.terminate()
  File "/opt/airflow/.venv/lib/python3.6/site-packages/airflow/task/task_runner/standard_task_runner.py", line 104, in terminate
    rcs = reap_process_group(self.process.pid, self.log)
  File "/opt/airflow/.venv/lib/python3.6/site-packages/airflow/utils/helpers.py", line 324, in reap_process_group
    signal_procs(sig)
  File "/opt/airflow/.venv/lib/python3.6/site-packages/airflow/utils/helpers.py", line 299, in signal_procs
    ["sudo", "-n", "kill", "-" + str(sig)] + [str(p.pid) for p in children]
  File "/usr/lib64/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'kill', '-Signals.SIGTERM', '16577', '16566']' returned non-zero exit status 1.

What you expected to happen:
kill should be invoked with the signal number

How to reproduce it:
Kick off any long running task that has run_as_user set to a different user than airflow worker and mark it as either success or failed in the admin UI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bugThis is a clearly a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions