Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let #snapshotPrimitive (97) copy/backup/rename .image file first #678

Open
marceltaeumel opened this issue Apr 2, 2024 · 6 comments
Open

Comments

@marceltaeumel
Copy link
Contributor

...or is this potentially an in-image feature?

Situation: You can potentially corrupt your .image during the snapshot primitive because:

  • object space may be larger than disk space left for the next/current snapshot
  • potential snapshot bug might corrupt file
  • operating system might decide to reboot/crash/...

We had two cases of corrupted .image files on Windows in the last 15 months. A simple copy-before-snapshot would have prevented data loss.

@codefrau
Copy link
Contributor

codefrau commented Apr 2, 2024

Unless there's a good reason I'd not make the primitive more complex. I don't see why this would need to be done in the VM.

@jvuletich
Copy link

I fully agree with Vanessa. Any such policy hardcoded in the VM will only limit the image choice on how to such backups.

@OpenSmalltalk-Bot
Copy link

OpenSmalltalk-Bot commented Apr 2, 2024 via email

@eliotmiranda
Copy link
Contributor

I agree with Juan & Vanessa that the backing up (eg rename image file to foo.image.bak) be done by the image, not by the snapshot primitive. There’s another thing the image should do also.

Currently the snapshot primitive does a full GC. This is somewhat of a good thing because it means that new space is always empty in a squeak snapshot and so loading is simpler. But full GCs signal objects for finalization, and this means that finalizations are done way too late, in the loading system, long after any associated state (open files et al), are up to date.

Instead, while the primitive should still GC to keep new space empty, the image should run a full GC before invoking the primitive, and not noble the primitive until finalization is complete. This ensures that

  • objects are not finalized twice, once in continuing from the snapshot, and once on loading/restarting the snapshot.
  • objects don’t get finalized, by the finalization state not being saved proper in the image (eg on save and quit)

@OpenSmalltalk-Bot
Copy link

OpenSmalltalk-Bot commented Apr 2, 2024 via email

@marceltaeumel
Copy link
Contributor Author

I agree with all suggestions. Let's see whether .image file locking might be an issue on some platforms. I suppose that only the .changes file is locked for a running image.

For limited disk space we might want to engineer a (risky) fallback later, including a way to estimate the required disk space with or without that extra backup. Since we are 64-bit these days and eventually with an incremental GC, multi-gig images could be more likely and working from a limited USB stick annoying then.

Thank you all for your thoughts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants