View Issue Details

IDProjectCategoryView StatusLast Update
0000175FreeCADFeaturepublic2015-09-19 11:15
ReporterwmayerAssigned Towmayer 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version 
Target VersionFixed in Version0.16 
Summary0000175: Auto save function
DescriptionAuto-save feature which saves a document every X minutes
TagsNo tags attached.

Relationships

has duplicate 0001897 closed Add a crash recovery file 

Activities

wmayer

2010-10-14 06:07

administrator   ~0000376

Reminder sent to: yorik

According to your request at http://forum.freecadweb.org/viewtopic.php?f=3&t=587

yorik

2010-10-15 11:23

administrator   ~0000380

Great! I think the best way would be to save to a temp file, so you don't risk overwriting your main file with some changes that you are just experimenting. Some applications just save a temp file in the same folder as the main file but with another name, other save it in the system temp folder, which is probably better, so it can be cleaned automatically by the system.

Jriegel

2011-02-01 12:47

administrator   ~0000567

Actually (again) I had a plan for that. Its partially implemented already
in the FreeCAD document. Its called "Transaction". Its basically like UNDO but
the other way around. It works as follwed:

Every change you make on the document triggers a transaction (for e.g. Undo).
This transaction is written do the temp space in a low prio thread. If FreeCAD
fails, you load the last (user) save and all the saved transactions and your
document is at the same version.

Transactions have several advantages:
You write only small pieces to disk (only actual changes) and not the whole
document (blocks the application for a long time). And its completely in the
background (user don't see it). Small disk footprint.

But again - had no time to finish the implementation.

yorik

2011-02-01 13:12

administrator   ~0000568

Very cleaver! This would be an incredible, never-seen-before real-time backup!!!

wmayer

2013-05-17 09:29

administrator   ~0003168

In order to make this working it needs to be checked when running a new FreeCAD instance if a previous instance crashed or not.

Therefore a lock file of the form "FreeCAD_<process id>.lock" gets created in the TEMP folder. This file is locked by the FreeCAD instance that created it. With a normal close the file gets unlocked and deleted. In case of a crash the file gets only unlocked but not deleted.

Now when running a new FreeCAD instance it searches for all lock files in the TEMP folder and checks if the file is locked or not. In case it's locked we know this file is occupied by another (or this) FreeCAD instance. If the file is not locked we know it's the leftover from a previous crash.

From the lock file name we now extract the PID and search for directories of the form FreeCAD_Doc_*_<PID>. If the directory is empty we can delete it because a restoration is impossible. If it contains any data we have to check if the document can be restored. This step needs to be implemented.

git show 37d1696

fhteagle

2015-04-10 02:44

reporter   ~0005987

With the number of crashes in FreeCAD I have had in the last 2 hours, I would consider this a much higher priority than "Minor".

yorik

2015-04-10 14:15

administrator   ~0005990

I had a quick look again at this, it looks like the /tmp/FreeCAD_Doc_*_PID folder is always empty for me (on creating a new file, opening an existing one, doing a couple of operations, etc...). What is it supposed to contain?

wmayer

2015-04-10 21:57

administrator   ~0005997

> What is it supposed to contain?
The svg files of a drawing, the wrl file of a VRML object, ...

mghansen256

2015-06-20 19:31

reporter   ~0006214

I am also looking forward to this feature! However, the /tmp directory on Linux is cleared at boot time, therefore if you restart after the crash or FreeCAD "crashed" because of power loss, you loose the ability to restore your work.

Maybe the stream could be saved in the same directory as the file on which the user works, I have seen some other applications do that. The configuration directory of FreeCAD could then hold a list of files that were open before the crash.

wmayer

2015-09-18 13:35

administrator   ~0006429

Related forum thread: http://forum.freecadweb.org/viewtopic.php?t=12312

wmayer

2015-09-19 08:35

administrator   ~0006434

> However, the /tmp directory on Linux is cleared at boot time...
This feature is requested in #0001238.

So, as far as I can see this feature is now fully implemented.

Issue History

Date Modified Username Field Change
2010-10-14 06:04 wmayer New Issue
2010-10-14 06:05 wmayer Category Bug => Feature
2010-10-14 06:07 wmayer Note Added: 0000376
2010-10-15 11:23 yorik Note Added: 0000380
2011-02-01 12:47 Jriegel Note Added: 0000567
2011-02-01 12:48 Jriegel Status new => assigned
2011-02-01 12:48 Jriegel Assigned To => Jriegel
2011-02-01 13:12 yorik Note Added: 0000568
2013-05-17 09:29 wmayer Note Added: 0003168
2015-01-05 22:17 wmayer Relationship added has duplicate 0001897
2015-04-10 02:44 fhteagle Note Added: 0005987
2015-04-10 14:15 yorik Note Added: 0005990
2015-04-10 21:57 wmayer Note Added: 0005997
2015-06-20 19:31 mghansen256 Note Added: 0006214
2015-09-04 13:09 wmayer Changeset attached => FreeCAD Master master 9cb63295
2015-09-04 13:16 wmayer Changeset attached => FreeCAD Master master 9253572a
2015-09-04 15:55 wmayer Changeset attached => FreeCAD Master master 16f81328
2015-09-17 12:48 wmayer Changeset attached => FreeCAD Master master 32367b17
2015-09-17 19:38 wmayer Changeset attached => FreeCAD Master master bb05d175
2015-09-18 13:33 wmayer Changeset attached => FreeCAD Master master 8db1280a
2015-09-18 13:35 wmayer Note Added: 0006429
2015-09-18 23:15 wmayer Changeset attached => FreeCAD Master master 848f9c4d
2015-09-19 08:35 wmayer Note Added: 0006434
2015-09-19 08:35 wmayer Assigned To Jriegel => wmayer
2015-09-19 08:52 wmayer Status assigned => closed
2015-09-19 08:52 wmayer Resolution open => fixed
2015-09-19 08:52 wmayer Fixed in Version => 0.16
2015-09-19 11:15 wmayer Changeset attached => FreeCAD Master master e5c3a095