tilt icon indicating copy to clipboard operation
tilt copied to clipboard

Starting two instances at the same time can cause cloning of extensions repo to fail

Open cmeury opened this issue 2 years ago • 3 comments

Expected Behavior

It is not immediately clear what the expectation should be; maybe the extensions repository could be cloned with a separate command, so the user can control the timing? Or some sort of simple locking mechanism (empty file in ~/local/share/tilt-dev))?

Current Behavior

Using a Tiltfile which loads extensions, starting two instance of Tilt can result in conflicts about cloning the extensions repository:

Tilt started on http://localhost:10350/
v0.32.4, built 2023-05-24
Serving embedded Tilt production web assets

Initial Build
Loading Tiltfile at: /home/cmeury/tmp/tilt-instance-test/Tiltfile
# cd .; git clone -- https://github.com/tilt-dev/tilt-extensions /home/cmeury/.local/share/tilt-dev/tilt_modules/github.com/tilt-dev/tilt-extensions
Cloning into '/home/cmeury/.local/share/tilt-dev/tilt_modules/github.com/tilt-dev/tilt-extensions'...
error: Untracked working tree file '.circleci/Dockerfile' would be overwritten by merge.
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

ERROR: extensionrepo default: download error: waiting 5s before retrying. Original error: exit status 128
ERROR: Traceback (most recent call last):
  /home/cmeury/tmp/tilt-instance-test/Tiltfile:1:1: in <toplevel>
Error: cannot load ext://secret: loading extension repo default: download error: waiting 5s before retrying. Original error: exit status 128

Steps to Reproduce

  1. Create a Tiltfile with a single entry: load('ext://secret', 'secret_from_dict')
  2. Run two instances of Tilt at the same time
    tilt up --debug --port 10350 > first.log &
    tilt up --debug --port 20350 > second.log &  
    
  3. Check the log files for errors

Context

tilt doctor Output

Tilt: v0.32.4, built 2023-05-24
System: linux-amd64

About Your Use Case

Running two Tilt instances at the same time on CI; for separate environments.

cmeury avatar Oct 10 '23 06:10 cmeury

good catch! ya, we should probably have some sort of file-based lock here :thinking:

nicks avatar Oct 10 '23 14:10 nicks

i've also been wondering if we should change the behavior slightly. rather than doing a git pull on every tilt up, maybe it should pin to the version of the extensions repo that came out when that version of tilt was released.

nicks avatar Oct 10 '23 21:10 nicks

@nicks That's also what we did in our workaround, just before starting the two instances:

git clone --depth 1 --branch v0.32.4 -- https://github.com/tilt-dev/tilt-extensions ~/.local/share/tilt-dev/tilt_modules/github.com/tilt-dev/tilt-extensions

cmeury avatar Oct 11 '23 05:10 cmeury