Powercut causing preferences to be reset

discdeath

New member
When something causes my computer to shut down (e.g. powercut, blown fuse...) while Mafia is running, it resets all of my preferences and settings. After the most recent time, I've finally committed to keeping a backup of the pref file.
Aside from that, is there anything I can do to prevent this. Also, can anyone explain exactly why it happens?
Thanks.
 

fronobulax

Developer
Staff member
From the standpoint of most software developers that is a hardware problem and the best solution would be to do whatever needs to be done to make sure that the computer shuts down cleanly.

There are a couple of possible reasons. If the act of shutting down causes file corruption on disk then mafia will reset things to the defaults since that is how it recovers. If the shutdown happens after a preference is updated but before it gets written to disk then the change obviously won't be saved.

I personally can't think of a way to implement disk I/O that will guarantee all changes will be saved, even during an unexpected shutdown. If there is one it is almost certainly more effort than a volunteer is going to expend.

I didn't look to see what mafia's write to disk strategy is but trying to write every time something changes causes performance problems so there is a trade off and at the moment a developer would have to change code.

So what you can do is a) back up often and b) find a hardware solution to the power issue such as using a laptop or an uninterruptible power supply.
 

Crowther

Active member
I lost all of my zlib settings because I stupidly ran out of disk space. One way to back these things up would be to use a revision control system like SVN. I should probably set up an automated job to do that daily.
 

Magus_Prime

Well-known member
I use sync.com to avoid exactly this issue. If something happens I just revert to an earlier version of the file.
 

fronobulax

Developer
Staff member
I lost all of my zlib settings because I stupidly ran out of disk space. One way to back these things up would be to use a revision control system like SVN. I should probably set up an automated job to do that daily.

I had local SVN repositories for various things but I never automated the check in/out to the point where "It Just Worked" so it was more trouble than it was ultimately worth once I stopped generating a lot of "personal" source files.

I did have some success with Dropbox. I was running mafia on multiple computers and it was a trivial way to synch scripts and preferences across machines. A side effect was that if I had a corrupted file I could unsynch until I got a better version from the other computer. Dropbox also has some limited versioning so I could also go back and get something closer to what was lost.

In a world where there are lots of cloud options, synching the mafia dist subdirectory to a cloud probably won't hurt although space considerations might be an issue with the sessions subdirectory.

In general writing a robust system that can survive a power outage is a high cost/high skill activity. Doing it reliably involves a lot of hardware and software redundancy.

I wasn't thinking of a cloud synch before because that too can fail when he power goes, but I missed the fact that it can usually provide a recent backup and that is certainly better than not having a backup.
 

ckb

Minion
Staff member
I did have some success with Dropbox. I was running mafia on multiple computers and it was a trivial way to synch scripts and preferences across machines. A side effect was that if I had a corrupted file I could unsynch until I got a better version from the other computer. Dropbox also has some limited versioning so I could also go back and get something closer to what was lost.

I use Dropbox for this reason - running mafia on multiple computers. Dropbox also keeps many multiple backup versions of files automatically, so if something get corrupted, it it easy to revert back to a previous version.
 

zarqon

Well-known member
I use Dropbox for this reason - running mafia on multiple computers. Dropbox also keeps many multiple backup versions of files automatically, so if something get corrupted, it it easy to revert back to a previous version.

Same, for the last 13 years. Dropbox doesn't give a lot of space for a free account, but it's more than enough for a mafia installation, even with various multis.
 
Top