Skip to content

Commit

Permalink
Merge pull request #23233 from cgwalters/doc-goroutine-leak
Browse files Browse the repository at this point in the history
containers/attach: Note bug around goroutine leak
  • Loading branch information
openshift-merge-bot[bot] authored Jul 9, 2024
2 parents c81bf72 + 4336c5a commit 345bac6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/bindings/containers/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ type CloseWriter interface {
CloseWrite() error
}

// Attach attaches to a running container
// Attach attaches to a running container.
//
// NOTE: When stdin is provided, this function currently leaks a goroutine reading from that stream
// even if the ctx is cancelled. The goroutine will only exit if the input stream is closed. For example,
// if stdin is `os.Stdin` attached to a tty, the goroutine will consume a chunk of user input from the
// terminal even after the container has exited. In this scenario the os.Stdin stream will not be expected
// to be closed.
func Attach(ctx context.Context, nameOrID string, stdin io.Reader, stdout io.Writer, stderr io.Writer, attachReady chan bool, options *AttachOptions) error {
if options == nil {
options = new(AttachOptions)
Expand Down

1 comment on commit 345bac6

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

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

podman-next COPR build failed. @containers/packit-build please check.

Please sign in to comment.