Livebook files are not saved and lost

The Elixir Livebooks don’t work properly. Even when auto saving is enabled, sometimes it’s not saved. I just lost several hours of work. Again!

Whoah that’s no good. When you say “not saved”, do you mean that changes vanish after a refresh? Or are things disappearing between sessions?

Will you check the logs for your livebook app? You can do this through our UI. It’s possible the Livebook process is running out of memory and crashing, which would lose state. You’ll see log messages that mention OOM if that’s the case.

Dang, losing work like that is so painful! Sorry to hear that!

I tried several things but I’m not able reproduce this. Can you provide any more information? I’ve run Elixir scripts that intentionally crash the Livebook instance and it still keeps my files.

It’s worth noting that the default location where files are stored is on the “Local Disk”. When running this on Fly.io, it means it’s running on a VM. It’s not guaranteed to be persistent storage.

Livebook offers a persistent storage option. Are you using that?

image

You can add an AWS S3 compatible storage location. The page also links to Storj which is S3 compatible and has free options.

I hope that helps!

@Josef_Richter I was wrong!

When the Livebook instance is created, a persistent volume is also created and mounted as /data. That’s where the notebook files are written.

So you do still have the option of external storage, but if you keep it in Livebook on Fly it should work. Even stopping and starting the instance on Fly kept my file.

If you have any additional info or steps to reproduce, I’m happy to look at it again!

I just experienced this as well, a bunch of times actually. At first I didn’t have a volume associated with my livebook instance and after session was killed bc of OOM I was losing some code, but then I’ve added some storage and everything seemed fine. I’ve also added some more RAM to avoid OOMs and made sure to save the livebook everytime I made a change. In the end I left my laptop for an hour or so and when I came back my work was back to the state it was sometime ago. I.e. not completely lost, but all the new parts were. I will try to come up with a minimal reproduction :+1:

1 Like

I had this issue today.
I had a draft LiveBook working with processes and I exhausted some resources
so I had to reboot my Mac. When I opened up LiveBook, my draft was not one of the
“Recent Notebooks” under the Open dialog.
I panicked.
But with some digging I found it.
Under System settings, look for the value of Autosave directory.
Surf to that location and you’ll find a bunch of date-stamped directories.
I found mine in the most recent one.
Loaded it into the LiveBook then saved it to a more memorable location.
Problem solved.

1 Like