Skip to content

Commit adc35b0

Browse files
committed
Add sleep before layer operation retries
This change adds a small sleep before a re-attempt on layer operation failures. These failures should only happen on RS5 and the probable cause is because of a different way in which container loopback vhds were mounted on this OS version. A theory of why things might go awry on RS5 is due to some events from pnp getting reported too late/early. If the prognosis is correct, a small sleep might help to try and get things back into a "good" state before a reattempt. Signed-off-by: Daniel Canter <[email protected]>
1 parent a0b5149 commit adc35b0

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

internal/layers/layers.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"fmt"
99
"os"
1010
"path/filepath"
11+
"time"
1112

1213
hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2"
1314
"github.com/Microsoft/hcsshim/internal/hcserror"
@@ -115,6 +116,9 @@ func MountContainerLayers(ctx context.Context, containerId string, layerFolders
115116
// for ERROR_NOT_READY as well.
116117
if hcserr, ok := lErr.(*hcserror.HcsError); ok {
117118
if hcserr.Err == windows.ERROR_NOT_READY || hcserr.Err == windows.ERROR_DEVICE_NOT_CONNECTED {
119+
// Sleep for a little before a re-attempt. A probable cause for these issues in the first place is events not getting
120+
// reported in time so might be good to give some time for things to "cool down" or get back to a known state.
121+
time.Sleep(time.Millisecond * 100)
118122
continue
119123
}
120124
}

0 commit comments

Comments
 (0)