Skip to content

Commit 8beee54

Browse files
authored
Fix build deadlock on UFFD error (#1091)
1 parent 1c9a64d commit 8beee54

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/orchestrator/internal/template/build/builder.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ func runBuild(
179179
index := cache.NewHashIndex(bc.CacheScope, builder.buildStorage, builder.templateStorage)
180180

181181
layerExecutor := layer.NewLayerExecutor(bc,
182+
builder.logger,
182183
builder.tracer,
183184
builder.networkPool,
184185
builder.devicePool,

packages/orchestrator/internal/template/build/layer/layer_executor.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type LayerExecutor struct {
2525
buildcontext.BuildContext
2626

2727
tracer trace.Tracer
28+
logger *zap.Logger
2829

2930
networkPool *network.Pool
3031
devicePool *nbd.DevicePool
@@ -38,6 +39,7 @@ type LayerExecutor struct {
3839

3940
func NewLayerExecutor(
4041
buildContext buildcontext.BuildContext,
42+
logger *zap.Logger,
4143
tracer trace.Tracer,
4244
networkPool *network.Pool,
4345
devicePool *nbd.DevicePool,
@@ -51,6 +53,7 @@ func NewLayerExecutor(
5153
return &LayerExecutor{
5254
BuildContext: buildContext,
5355

56+
logger: logger,
5457
tracer: tracer,
5558

5659
networkPool: networkPool,
@@ -90,6 +93,12 @@ func (lb *LayerExecutor) BuildLayer(
9093
return metadata.Template{}, err
9194
}
9295
defer sbx.Stop(ctx)
96+
go func() {
97+
err := sbx.Wait(context.WithoutCancel(ctx))
98+
if err != nil {
99+
lb.logger.Error("error waiting for sandbox", zap.Error(err))
100+
}
101+
}()
93102

94103
// Add to proxy so we can call envd commands
95104
lb.sandboxes.Insert(sbx.Runtime.SandboxID, sbx)

0 commit comments

Comments
 (0)