Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions internal/timeout/timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ var (

// TestDRetryLoop is the timeout for testd retry loop when onlining a SCSI disk in LCOW
TestDRetryLoop = defaultTimeoutTestdRetry

// This timeout is used for GCS connection after uvm boot as well as the entropy
// and log connection setup during uvm boot. This is different than the
// SystemStart timeout defined above.
GCSConnectionTimeout = 2 * time.Minute
)

func init() {
Expand All @@ -60,6 +65,7 @@ func init() {
ExternalCommandToStart = durationFromEnvironment("HCSSHIM_TIMEOUT_EXTERNALCOMMANDSTART", ExternalCommandToStart)
ExternalCommandToComplete = durationFromEnvironment("HCSSHIM_TIMEOUT_EXTERNALCOMMANDCOMPLETE", ExternalCommandToComplete)
TestDRetryLoop = durationFromEnvironment("HCSSHIM_TIMEOUT_TESTDRETRYLOOP", TestDRetryLoop)
GCSConnectionTimeout = durationFromEnvironment("HCSSHIM_TIMEOUT_GCSCONNECTION", GCSConnectionTimeout)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT, from Env doesnt do a parse to include things like 10s vs 10m. So is the env var a raw value here? What is the unit?

@ambarve ambarve Aug 21, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the value should be a string representing the timeout in seconds. I kept it like this to maintain the same format that other variables have. But I can update the variable name to something like HCSSHIM_GCSCONNECTION_TIMEOUT_SECONDS?

}

func durationFromEnvironment(env string, defaultValue time.Duration) time.Duration {
Expand Down
5 changes: 4 additions & 1 deletion internal/uvm/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/Microsoft/hcsshim/internal/logfields"
"github.com/Microsoft/hcsshim/internal/protocol/guestrequest"
"github.com/Microsoft/hcsshim/internal/protocol/guestresource"
"github.com/Microsoft/hcsshim/internal/timeout"
"github.com/Microsoft/hcsshim/internal/uvm/scsi"
)

Expand Down Expand Up @@ -157,7 +158,9 @@ func (uvm *UtilityVM) configureHvSocketForGCS(ctx context.Context) (err error) {
func (uvm *UtilityVM) Start(ctx context.Context) (err error) {
// save parent context, without timeout to use in terminate
pCtx := ctx
ctx, cancel := context.WithTimeout(pCtx, 2*time.Minute)
ctx, cancel := context.WithTimeout(pCtx, timeout.GCSConnectionTimeout)
log.G(ctx).Debugf("using gcs connection timeout: %s\n", timeout.GCSConnectionTimeout)

g, gctx := errgroup.WithContext(ctx)
defer func() {
_ = g.Wait()
Expand Down