View Issue Details

IDProjectCategoryView StatusLast Update
0001777Dwarf FortressTechnical -- Generalpublic2017-05-17 14:21
ReporterThe Architect Assigned To 
PriorityhighSeverityblockReproducibilityhave not tried
Status newResolutionopen 
OSVista 
Product Version0.31.03 
Summary0001777: Multiple instances of DF can run simultaneously in same folder, resulting in save corruption
DescriptionSaving simultaneously in duplicate DF applications causes corruption in one or more.

"One of the compressed files on disk has errors on it. Restore from backup if you are able."
Steps To ReproduceBack up your data/save folder.
Open DF twice from the same copy, open two separate forts. Save both simultaneously. If the program manages to complete both saves, attempt to open the files.
TagsNo tags attached.

Relationships

has duplicate 0002641 resolveduser6 Multiple instances of the game can be opened 
has duplicate 0005518 resolveduser1294 Simultaneously using legends mode and adventure mode might lead to save file problems 

Activities

user6

2010-05-05 22:25

  ~0006241

Last edited: 2010-05-05 22:27

Most likely because they're sharing the "current" folder. That was probably the motivation for this old bug entry:

# 000020 □ [technical] (http://www.bay12forums.com/smf/index.php?topic=21812.0) stop multiple copies of the program from being open

shibdib

2010-07-11 17:17

reporter   ~0009985

confirmed still in 0.31.10

zombiejustice

2012-03-01 06:04

reporter   ~0020942

This doesn't seem like high priority: you're doing something OUTSIDE the game, that you know will break the game. Should this be closed as 'working as intended'?

user6

2012-03-01 07:08

  ~0020943

As I mentioned in the first note, this was in the old bug list that Toady used to maintain (dev_bugs.html).

thvaz

2012-03-01 09:00

reporter   ~0020947

If he never got around to fix it, maybe he doesn't know how? He may need some help then.

I have little experience as a programmer, but this doesn't sound like something that would demand a lot of time.

Xotano

2012-03-01 09:02

reporter   ~0020948

well you would think people would refrain from opening multiple game windows.

Brilliand

2013-06-06 15:11

reporter   ~0023994

Multiple instances of DF being able to load the same save is a good thing. However, it should probably balk at overwriting a save that doesn't match the one it loaded (say, store a version number somewhere). If that happens, it could maybe offer to save in a different folder.

That's getting pretty far away from the "permanent death" ideal, but I don't like permanent death anyway. :p

alexchandel

2017-05-11 13:16

reporter   ~0036522

I recently had to run two DF instances at once, so I'm glad it's possible.

Assuming you don't attempt to save, and kill both processes with killall/SIGTERM, is there any possible way DF can corrupt any of its files?

As far as behavior, the only change that could be added is: locking on a lock-file in the region folder when saving, so that another process doesn't try to simultaneously save and corrupt the files.

lethosor

2017-05-17 14:21

manager   ~0036537

If you don't save, as far as I know, the only files that will be touched are those in data/save/current, which is cleared periodically.

However, I would still recommend not doing what you did, because DF could be confused if it tries to read files from data/save/current and gets files from another save, or if it fails to read files that the other DF process deleted already.

As for your locking suggestion, that wouldn't prevent corruption, because if data/save/current contains files from two different saves, they'll still be copied into the wrong region folder(s).

Add Note

Note

Issue History

Date Modified Username Field Change
2010-05-05 22:17 The Architect New Issue
2010-05-05 22:25 user6 Note Added: 0006241
2010-05-05 22:27 user6 Note Edited: 0006241
2010-06-29 07:38 user6 Category Technical => Technical -- General
2010-07-11 16:50 user6 Relationship added has duplicate 0002641
2010-07-11 16:50 user6 Summary Saving simultaneously with two DF programs causes file corruption => Multiple instances of DF can run simultaneously in same folder, resulting in save corruption
2010-07-11 17:17 shibdib Note Added: 0009985
2012-03-01 02:14 user1294 Relationship added has duplicate 0005518
2012-03-01 06:04 zombiejustice Note Added: 0020942
2012-03-01 07:08 user6 Note Added: 0020943
2012-03-01 09:00 thvaz Note Added: 0020947
2012-03-01 09:02 Xotano Note Added: 0020948
2012-09-20 08:04 user6 Relationship added has duplicate 0006204
2013-06-06 15:11 Brilliand Note Added: 0023994
2014-01-20 19:06 user6 Relationship deleted has duplicate 0006204
2017-05-11 13:16 alexchandel Note Added: 0036522
2017-05-17 14:21 lethosor Note Added: 0036537