File tree Expand file tree Collapse file tree 3 files changed +27
-9
lines changed
image-builder-bob/cmd/runc-facade Expand file tree Collapse file tree 3 files changed +27
-9
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ var aptUpdated = false
59
59
const (
60
60
dockerSocketFN = "/var/run/docker.sock"
61
61
gitpodUserId = 33333
62
+ containerIf = "ceth0"
62
63
)
63
64
64
65
func main () {
@@ -135,7 +136,6 @@ func runWithinNetns() (err error) {
135
136
}
136
137
args = append (args , userArgs ... )
137
138
138
- containerIf := "ceth0"
139
139
netIface , err := netlink .LinkByName (containerIf )
140
140
if err != nil {
141
141
return xerrors .Errorf ("cannot get container network device %s: %w" , containerIf , err )
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ import (
15
15
"golang.org/x/xerrors"
16
16
)
17
17
18
+ const RETRY = 3
19
+
18
20
var (
19
21
defaultOOMScoreAdj = 1000
20
22
)
@@ -86,9 +88,15 @@ func createAndRunc(runcPath string, log *logrus.Logger) error {
86
88
}
87
89
}
88
90
89
- err = syscall .Exec (runcPath , os .Args , os .Environ ())
90
- if err != nil {
91
- return xerrors .Errorf ("exec %s: %w" , runcPath , err )
91
+ // See here for more details on why retries are necessary.
92
+ // https://github.com/gitpod-io/gitpod/issues/12365
93
+ for i := 0 ; i <= RETRY ; i ++ {
94
+ err = syscall .Exec (runcPath , os .Args , os .Environ ())
95
+ if err == nil {
96
+ return err
97
+ } else {
98
+ log .WithError (err ).Warn ("runc failed" )
99
+ }
92
100
}
93
- return nil
101
+ return xerrors . Errorf ( "exec %s: %w" , runcPath , err )
94
102
}
Original file line number Diff line number Diff line change @@ -11,11 +11,14 @@ import (
11
11
"path/filepath"
12
12
"syscall"
13
13
14
+ "github.com/gitpod-io/gitpod/common-go/log"
14
15
"github.com/opencontainers/runtime-spec/specs-go"
15
16
"github.com/sirupsen/logrus"
16
17
"golang.org/x/xerrors"
17
18
)
18
19
20
+ const RETRY = 2
21
+
19
22
func main () {
20
23
log := logrus .New ()
21
24
log .SetLevel (logrus .DebugLevel )
@@ -95,9 +98,16 @@ func createAndRunc(runcPath, bundle string) error {
95
98
}
96
99
}
97
100
98
- err = syscall .Exec (runcPath , os .Args , os .Environ ())
99
- if err != nil {
100
- return xerrors .Errorf ("exec %s: %w" , runcPath , err )
101
+ // See here for more details on why retries are necessary.
102
+ // https://github.com/gitpod-io/gitpod/issues/12365
103
+ for i := 0 ; i <= RETRY ; i ++ {
104
+ err = syscall .Exec (runcPath , os .Args , os .Environ ())
105
+ if err == nil {
106
+ return err
107
+ } else {
108
+ log .WithError (err ).Warn ("runc failed" )
109
+ }
101
110
}
102
- return nil
111
+
112
+ return xerrors .Errorf ("exec %s: %w" , runcPath , err )
103
113
}
You can’t perform that action at this time.
0 commit comments