File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,15 +65,30 @@ type processIO struct {
6565}
6666
6767func (p * processIO ) Close () error {
68+ var result []error
6869 if p .io != nil {
69- return p .io .Close ()
70+ if err := p .io .Close (); err != nil {
71+ result = append (result , err )
72+ }
7073 }
74+ // Close the stream connections too. For the "stream" scheme both p.io
75+ // (the runc pipes) and p.streams (the vsock conns to the host shim) are
76+ // set, so closing p.io alone leaves the streams open. On the normal exit
77+ // path the copyPipes goroutines close the streams themselves once the
78+ // runc pipes EOF, but if the exec process fails to start, copyPipes is
79+ // never reached and this Close is the only cleanup. Leaving the streams
80+ // open wedges the host shim's IO-shutdown (it waits for an EOF that never
81+ // comes) until its 30s timeout fires. Closing here propagates EOF
82+ // immediately. Streams already closed by copyPipes return ErrClosed,
83+ // which callers ignore.
7184 for i , s := range p .streams {
7285 if s != nil && (i != 2 || s != p .streams [1 ]) {
73- s .Close ()
86+ if err := s .Close (); err != nil {
87+ result = append (result , err )
88+ }
7489 }
7590 }
76- return nil
91+ return errors . Join ( result ... )
7792}
7893
7994func (p * processIO ) IO () runc.IO {
You can’t perform that action at this time.
0 commit comments