tilt-dev / tilt-dev/tilt

local_resource can leave running processes after Tilt is terminated

Open
#4,648 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
10.1k
Forks
413
Avg merge
1d 10h
Merged PRs (30d)
6

Description

Expected Behavior
  • All local_resource processes terminate when Tilt terminates
    • This is different than k8s_resource behavior which are left until tilt down but is the expected current behavior
Current Behavior
  • Processes can be left behind under some circumstances
    • Tilt quits unexpectedly (e.g. panic due to a Tilt bug)
    • User hits Ctrl-C twice in rapid succession
    • Process doesn't respond to SIGTERM
      • Tilt only waits 2 seconds on shutdown, we only send a SIGKILL if process takes more than 30 secs to respond to SIGTERM
Steps to Reproduce

See cases above - a good real world example is docker run --rm ..., especially if it doesn't respond well to SIGTERM which is fairly common, especially with entrypoint trampolines in some containers

Context

There's no way to ask the OS to kill all child processes when the parent exits. The most robust way looks to be to use an intermediate process that keeps an eye on the parent process and then kills the real child and exits itself.

We can at least do a little bit better here in the exit code by ensuring we SIGKILL everything before giving up after 2 seconds and/or on second Ctrl-C.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how local_resource processes are started and how Tilt handles shutdown and repeated Ctrl-C. Reproduce the listed termination cases, then verify that all local_resource processes are forcibly terminated within the expected shutdown behavior, including when SIGTERM is ignored.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.