Skip to content

Live Sync Sporadically Does Full Rebuild #5196

@rwoll

Description

@rwoll

Expected Behavior

Several touches or edits to a live_update sync'd file should only use existing container and not trigger a build or recreate.

Current Behavior

Sporadically, and seemingly non-deterministically, Tilt will decide to do a full build/recreate of a container even though we expect it to simply be doing a live_update+sync. This is true with a very aggressive .dockerignore, too. These even happens for trivial changes like simply saving the same file repeatedly. It'll be fine the first few saves (i.e. get live sync'd), but then sporadically when you go to save, Tilt decides to recreate the whole container. This is even while all working on the same file without switching between files.

Steps to Reproduce

$ git clone https://github.com/rwoll/tilt-live-sync-triggers-full-rebuild-repro.git
$ cd tilt-live-sync-triggers-full-rebuild-repro
$ tilt up

Once Tilt is up and the ui resource is green, start editing src/App.tsx a bunch (saving every couple of edits). You can also simply try running:

$ for i in `seq 1 100`; do echo $i; touch src/App.tsx; sleep 10; done

In the Tilt UI, most of the time you'll see it live sync but ever couple of saves it will do a full re-rcreate:

repro-example-tilt

The above happened when I simply did a touch on src/App.tsx 3 times in a row waiting a bit in between. The first two times it did what you'd expect, but the 3rd time it decided to do a full build+recreate.

Context

Some things to note:

  1. The linked repro was created via Create React App:

    $ npx create-react-app my-app --template typescript --use-npm
    
  2. We're using Docker Compose, not k8s.

  3. We're using a specifically named container in our DC config

  4. This was repo'able on 3 different macOS machines (2 of which are M1s)

  5. tilt describe filewatches docker-compose:ui didn't output anything unexpected. It just lists the src/App.tsx changes.

tilt doctor Output

$ tilt doctor
Tilt: v0.23.0, built 2021-11-12
System: darwin-amd64
---
Docker
- Host: [default]
- Server Version: 20.10.8
- API Version: 1.41
- Builder: 2
- Compose Version: v1.29.2 (build 5becea4c)
---
Kubernetes
- Env: docker-for-desktop
- Context: docker-desktop
- Cluster Name: docker-desktop
- Namespace: default
- Container Runtime: docker
- Version: v1.21.5
- Cluster Local Registry: none
---

About Your Use Case

We can't use Tilt with our UI dev for now so it has a more involved setup than the rest of our Tilt workflow (which is basically just tilt up since Tilt is generally so awesome! <3 ) We gave UI dev in Tilt a shot, but the sporadic slower updates when we hit this case made us decide to switch back to running the UI in a different way.

Overall, we're loving Tilt so we'd appreciate any help debugging this! Thanks so much for your work! 😄

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions