Add rootfs reboot fallback for snapshots#2875
Conversation
PR SummaryHigh Risk Overview Reviewed by Cursor Bugbot for commit f162320. Bugbot is set up for automated code reviews on this repo. Configure here. |
❌ 4 Tests Failed:
View the full list of 4 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
Code Review
The empty memfile created by block.NewEmpty in createSandboxFromRootfs is never closed, leading to a file descriptor and resource leak on both successful and failed sandbox creation paths. This should be resolved by deferring a call to close the memfile immediately after its creation.
## Summary Use one denormalized `file_type` metric attribute for upload compression metrics (`memfile`, `memfile-header`, `rootfs`, `rootfs-header`, `snap`, `meta`) instead of splitting `artifact` and `file_type`. ## Test plan - `cd packages/orchestrator && go test ./pkg/sandbox -run TestNonexistent` - `cd packages/orchestrator && golangci-lint run ./pkg/sandbox/...`
…back' into cova/rootfs-reboot-snapshot-fallback
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Rootfs reboot breaks memory snapshots
- Removed empty memfile masking in createSandboxFromRootfs so pause/checkpoint operations use the underlying template's memfile as the appropriate base for memory diffing instead of an incorrect empty memfile.
Or push these changes by commenting:
@cursor push c0f29e8484
Preview (c0f29e8484)
diff --git a/packages/orchestrator/pkg/server/sandboxes.go b/packages/orchestrator/pkg/server/sandboxes.go
--- a/packages/orchestrator/pkg/server/sandboxes.go
+++ b/packages/orchestrator/pkg/server/sandboxes.go
@@ -31,7 +31,6 @@
sbxtemplate "github.com/e2b-dev/infra/packages/orchestrator/pkg/sandbox/template"
"github.com/e2b-dev/infra/packages/orchestrator/pkg/template/constants"
"github.com/e2b-dev/infra/packages/orchestrator/pkg/template/metadata"
- "github.com/e2b-dev/infra/packages/orchestrator/pkg/units"
"github.com/e2b-dev/infra/packages/shared/pkg/events"
fcmodels "github.com/e2b-dev/infra/packages/shared/pkg/fc/models"
"github.com/e2b-dev/infra/packages/shared/pkg/featureflags"
@@ -39,7 +38,6 @@
"github.com/e2b-dev/infra/packages/shared/pkg/logger"
sbxlogger "github.com/e2b-dev/infra/packages/shared/pkg/logger/sandbox"
"github.com/e2b-dev/infra/packages/shared/pkg/storage"
- "github.com/e2b-dev/infra/packages/shared/pkg/storage/header"
"github.com/e2b-dev/infra/packages/shared/pkg/telemetry"
"github.com/e2b-dev/infra/packages/shared/pkg/utils"
)
@@ -315,27 +313,7 @@
runtime sandbox.RuntimeMetadata,
req *orchestrator.SandboxCreateRequest,
) (*sandbox.Sandbox, error) {
- pageSize := int64(header.PageSize)
- if config.HugePages {
- pageSize = int64(header.HugepageSize)
- }
-
- buildID, err := uuid.Parse(template.Files().BuildID)
- if err != nil {
- return nil, fmt.Errorf("parse build id: %w", err)
- }
-
- memfile, err := block.NewEmpty(
- units.MBToBytes(config.RamMB),
- pageSize,
- buildID,
- )
- if err != nil {
- return nil, fmt.Errorf("create empty memfile: %w", err)
- }
- defer memfile.Close()
-
- maskedTemplate := sbxtemplate.NewMaskTemplate(template, sbxtemplate.WithMemfile(memfile))
+ maskedTemplate := sbxtemplate.NewMaskTemplate(template)
ioEngine := fcmodels.DriveIoEngineSync
kvmClock, err := utils.IsGTEVersion(config.Envd.Version, "0.2.11")
if err != nil {You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 9e58d28. Configure here.


Summary
Tests