-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Ensure that start() in StartAndAttach() is locked #3127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -207,7 +207,7 @@ localunit: test/goecho/goecho varlink_generate | |
| ./contrib/cirrus/lib.sh.t | ||
|
|
||
| ginkgo: | ||
| ginkgo -v -tags "$(BUILDTAGS)" $(GINKGOTIMEOUT) -cover -flakeAttempts 3 -progress -trace -noColor -nodes 3 test/e2e/. | ||
| ginkgo -v -tags "$(BUILDTAGS)" $(GINKGOTIMEOUT) -cover -flakeAttempts 3 -progress -trace -noColor -nodes 3 -debug test/e2e/. | ||
|
|
||
| ginkgo-remote: | ||
| ginkgo -v -tags "$(BUILDTAGS) remoteclient" $(GINKGOTIMEOUT) -cover -flakeAttempts 3 -progress -trace -noColor test/e2e/. | ||
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ import ( | |
| "net" | ||
| "os" | ||
| "path/filepath" | ||
| "sync" | ||
|
|
||
| "github.com/containers/libpod/pkg/kubeutils" | ||
| "github.com/containers/libpod/utils" | ||
|
|
@@ -31,7 +32,7 @@ const ( | |
|
|
||
| // Attach to the given container | ||
| // Does not check if state is appropriate | ||
| func (c *Container) attach(streams *AttachStreams, keys string, resize <-chan remotecommand.TerminalSize, startContainer bool) error { | ||
| func (c *Container) attach(streams *AttachStreams, keys string, resize <-chan remotecommand.TerminalSize, startContainer bool, wg *sync.WaitGroup) error { | ||
| if !streams.AttachOutput && !streams.AttachError && !streams.AttachInput { | ||
| return errors.Wrapf(ErrInvalidArg, "must provide at least one stream to attach to") | ||
| } | ||
|
|
@@ -48,12 +49,17 @@ func (c *Container) attach(streams *AttachStreams, keys string, resize <-chan re | |
|
|
||
| logrus.Debugf("Attaching to container %s", c.ID()) | ||
|
|
||
| return c.attachContainerSocket(resize, detachKeys, streams, startContainer) | ||
| return c.attachContainerSocket(resize, detachKeys, streams, startContainer, wg) | ||
| } | ||
|
|
||
| // attachContainerSocket connects to the container's attach socket and deals with the IO | ||
| // attachContainerSocket connects to the container's attach socket and deals with the IO. | ||
| // wg is only required if startContainer is true | ||
| // TODO add a channel to allow interrupting | ||
| func (c *Container) attachContainerSocket(resize <-chan remotecommand.TerminalSize, detachKeys []byte, streams *AttachStreams, startContainer bool) error { | ||
| func (c *Container) attachContainerSocket(resize <-chan remotecommand.TerminalSize, detachKeys []byte, streams *AttachStreams, startContainer bool, wg *sync.WaitGroup) error { | ||
|
||
| if startContainer && wg == nil { | ||
| return errors.Wrapf(ErrInternal, "wait group not passed when startContainer set") | ||
| } | ||
|
|
||
| kubeutils.HandleResizing(resize, func(size remotecommand.TerminalSize) { | ||
| controlPath := filepath.Join(c.bundlePath(), "ctl") | ||
| controlFile, err := os.OpenFile(controlPath, unix.O_WRONLY, 0) | ||
|
|
@@ -84,10 +90,13 @@ func (c *Container) attachContainerSocket(resize <-chan remotecommand.TerminalSi | |
| } | ||
| defer conn.Close() | ||
|
|
||
| // If starting was requested, start the container and notify when that's | ||
| // done. | ||
| if startContainer { | ||
| if err := c.start(); err != nil { | ||
| return err | ||
| } | ||
| wg.Done() | ||
| } | ||
|
|
||
| receiveStdoutError := make(chan error) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not look like this should be merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vrothberg this option is needed with
-nodes 3to make ginkgo log output from each node. Otherwise, if any node hangs for any reason, it's incredibly difficult to debug which test caused the problem.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, that sounds important. The commit message mentions not to merge it, so we might need to change the message to avoid confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially we just wanted it for debug, so I added the quick "HACK" message. Changed now.