1
0
forked from wrenn/wrenn

Fix review issues: detached contexts, loop device leak, timer leak, size_bytes

- Use context.Background() with timeout in destroySandbox/failBuild so
  cleanup and DB writes survive parent context cancellation on shutdown
- Fix loop device refcount leak in FlattenRootfs when dmDevice is nil
- Replace time.After with time.NewTimer in healthcheck polling to avoid
  goroutine leak when healthcheck passes early
- Capture size_bytes from CreateSnapshot/FlattenRootfs RPC responses
  instead of hardcoding 0 in the templates table insert
- Avoid leaking internal error details to API clients in build handler
This commit is contained in:
2026-03-26 15:31:38 +06:00
parent 1ce62934b3
commit cdd89a7cee
3 changed files with 26 additions and 10 deletions

View File

@ -3,6 +3,7 @@ package api
import (
"encoding/json"
"fmt"
"log/slog"
"net/http"
"time"
@ -119,7 +120,8 @@ func (h *buildHandler) Create(w http.ResponseWriter, r *http.Request) {
MemoryMB: req.MemoryMB,
})
if err != nil {
writeError(w, http.StatusInternalServerError, "build_error", err.Error())
slog.Error("failed to create build", "error", err)
writeError(w, http.StatusInternalServerError, "build_error", "failed to create build")
return
}