Skip to content

Conversation

@Sayan-
Copy link
Contributor

@Sayan- Sayan- commented Jul 11, 2025

Description

As we've stress tested the recording server more we've noticed the behavior from pause <> resume to be a bit more unpredictable than we'd like. Instead we're opt'ing to leverage the pseudo file detailed in the unikraft docs to disable scale to zero while we're recording.

  • The interface doesn't change - the expectation is that the caller will still call Stop but the browser instance will stay live + recording for the duration between [Start, Stop]
  • I've relaxed the condition of having only 1 active recorder alive. I've tested ffmpeg is happy with this in both runtimes. Note: we expect names to be unique and we will reject any duplicates.
  • I've also added a timeout that we thread into ffmpeg that will work in conjunction with the existing max size as a guardrail.
  • Added a method to list all recorders for simpler integration + export

The main thing to call out here is I've pushed the implementation of the scale to zero down into the recorder so it will be re-enabled as soon as possible (e.g. the moment the recording is complete or the user has explicitly called to Stop recording. These may race which is why I've wrapped this in a sync.Once to make it more forgiving)

Testing

Tested with the end to end automation suite. The expected behavior that the instance would stay in running until shutdown was explicitly called was confirmed

@Sayan- Sayan- requested a review from rgarcia July 11, 2025 00:23
cursor[bot]

This comment was marked as outdated.

Comment on lines +29 to +58
func (c *unikraftCloudController) Disable(ctx context.Context) error {
return c.write(ctx, "+")
}

func (c *unikraftCloudController) Enable(ctx context.Context) error {
return c.write(ctx, "-")
}

func (c *unikraftCloudController) write(ctx context.Context, char string) error {
if _, err := os.Stat(c.path); err != nil {
if os.IsNotExist(err) {
return nil
}
logger.FromContext(ctx).Error("failed to stat scale-to-zero control file", "path", c.path, "err", err)
return err
}

f, err := os.OpenFile(c.path, os.O_WRONLY|os.O_TRUNC, 0)
if err != nil {
logger.FromContext(ctx).Error("failed to open scale-to-zero control file", "path", c.path, "err", err)
return err
}
defer f.Close()
if _, err := f.Write([]byte(char)); err != nil {
logger.FromContext(ctx).Error("failed to write scale-to-zero control file", "path", c.path, "err", err)
return err
}
return nil
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sayan- Sayan- marked this pull request as draft July 11, 2025 01:46
@Sayan- Sayan- force-pushed the sayan/scaletozero branch from ba5206f to 0908bb9 Compare July 11, 2025 21:58
@Sayan- Sayan- marked this pull request as ready for review July 11, 2025 22:46
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@Sayan-
Copy link
Contributor Author

Sayan- commented Jul 11, 2025

removal of xerrors was intentional

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@Sayan- Sayan- force-pushed the sayan/scaletozero branch from c026bc5 to 346376e Compare July 14, 2025 19:39
@Sayan- Sayan- changed the title Block scale to zero during recording Block scale to zero during recording, allow multiple recordings Jul 14, 2025
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@cursor
Copy link

cursor bot commented Jul 15, 2025

🚨 BugBot couldn't run

Something went wrong. Try again by commenting "bugbot run", or contact support (requestId: serverGenReqId_1eefc081-5ee3-4a1a-9905-acec10813503).

@cursor
Copy link

cursor bot commented Jul 15, 2025

🚨 BugBot couldn't run

Something went wrong. Try again by commenting "bugbot run", or contact support (requestId: serverGenReqId_ef950486-8c2c-4276-9203-59d76ad18550).

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Recorder List Method Misnamed

The FFmpegManager.ListActiveRecorders method is misnamed. It returns all registered recorders instead of only active (currently recording) ones, as its name implies. This is a regression, as the previous implementation correctly filtered for active recorders using IsRecording(). This mismatch between the method's name and its behavior breaks its implied contract and can lead to developer confusion.

server/lib/recorder/ffmpeg.go#L424-L434

https://github.com/onkernel/kernel-images/blob/69f5ebc8fd6670ccbee746ab754f66ef573ea79d/server/lib/recorder/ffmpeg.go#L424-L434

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@Sayan- Sayan- requested a review from rgarcia July 15, 2025 18:23
@Sayan- Sayan- merged commit 6042bde into main Jul 15, 2025
2 checks passed
@Sayan- Sayan- deleted the sayan/scaletozero branch July 15, 2025 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants