fix: noWatch sync no longer prevents SSH injection#3205
Open
raman1236 wants to merge 1 commit intodevspace-sh:mainfrom
Open
fix: noWatch sync no longer prevents SSH injection#3205raman1236 wants to merge 1 commit intodevspace-sh:mainfrom
raman1236 wants to merge 1 commit intodevspace-sh:mainfrom
Conversation
When a sync config has noWatch: true, the sync goroutine completes after initial sync and defer-cancels its context. This triggers the RestartOnError handler which calls parent.Kill(nil), putting the tomb in a dying state. Since SSH starts after sync completes (it waits on <-syncDone), the killed tomb prevents SSH from starting. Fix: set RestartOnError to false when NoWatch is true. A one-shot sync has no need for restart-on-error handling, and this prevents the handler from killing the parent tomb on context cancellation. Fixes devspace-sh#3005
✅ Deploy Preview for devspace-docs canceled.Built without sensitive environment variables
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a sync config has
noWatch: true, SSH server injection never starts. The SSH section indevspace.yamlis completely ignored when any sync entry hasnoWatch: true.Root Cause
The dev mode starts services in sequence: sync → port forwarding → SSH. SSH only starts after sync initialization completes (
<-syncDone).When
noWatch: true:StartSynccreates a cancelable context for that sync entrydefer cancel()fires, cancelling the contextstartWithWait()had registered aRestartOnErrorgoroutine viaparent.Go()that listens onctx.Context().Done()syncStop()→parent.Kill(nil)<-syncDone) either cannot start or is immediately terminated because the tomb is dyingFix
Set
RestartOnErrortofalsewhenNoWatchistrue. A one-shot sync has no need for restart-on-error handling since it completes after initial sync. This prevents the restart handler goroutine from being registered, which in turn prevents it from killing the parent tomb when the cancelled context fires.Change
In
pkg/devspace/services/sync/sync.go,startSync():Fixes #3005