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
8 changes: 7 additions & 1 deletion cmd/dmverity-vhd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,13 @@ func fetchImageLayers(ctx *cli.Context) (layers []v1.Layer, err error) {
// if only an image name is provided and not a tag, the default is "latest"
img, err = tarball.ImageFromPath(tarballPath, &imageNameAndTag)
} else if dockerDaemon {
img, err = daemon.Image(ref)
// use the unbuffered opener, the tradeoff being the image will stream as needed
// so it is slower but much more memory efficient
var opts []daemon.Option
opt := daemon.WithUnbufferedOpener()
opts = append(opts, opt)

img, err = daemon.Image(ref, opts...)
} else {
var remoteOpts []remote.Option
if ctx.IsSet(usernameFlag) && ctx.IsSet(passwordFlag) {
Expand Down
14 changes: 6 additions & 8 deletions internal/hcs/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,6 @@ func (process *Process) CloseStdin(ctx context.Context) (err error) {
return makeProcessError(process, operation, ErrAlreadyClosed, nil)
}

process.stdioLock.Lock()
defer process.stdioLock.Unlock()
if process.stdin == nil {
return nil
}

//HcsModifyProcess request to close stdin will fail if the process has already exited
if !process.stopped() {
modifyRequest := processModifyRequest{
Expand All @@ -448,8 +442,12 @@ func (process *Process) CloseStdin(ctx context.Context) (err error) {
}
}

process.stdin.Close()
process.stdin = nil
process.stdioLock.Lock()
defer process.stdioLock.Unlock()
if process.stdin != nil {
process.stdin.Close()
process.stdin = nil
}

return nil
}
Expand Down