View Issue Details

IDProjectCategoryLast Update
0026665AI War 2Bug - OtherMar 15, 2022 1:29 pm
Reporterhenry700 Assigned ToChris_McElligottPark  
Status feedbackResolutionreopened 
Product Version4.002 Macrophage Live! 
Fixed in Version4.004 Easy There, Hack Response 
Summary0026665: IronMan mode - Could not delete savegame metadata (Windows Locking)
DescriptionProbably only happens on Windows, because of file locking when files are opened without certain flags on .NET.

Relevant piece from logs:

3/8/2022 11:55:56 PM 4.002 SINGLEP DELAYED24 TID56 Could not delete savegame metadata: D:/SteamLibrary/steamapps/common/AI War 2/PlayerData/Save/Aurora/Ironman Save at 10m 7s.savemet
System.IO.IOException: Sharing violation on path D:/SteamLibrary/steamapps/common/AI War 2/PlayerData/Save/Aurora/Ironman Save at 10m 7s.savemet
  at System.IO.File.Delete (System.String path) [0x00073] in <695d1cc93cca45069c528c15c9fdd749>:0
  at Arcen.Universal.World.DeleteSaveGame (System.String FullSaveName, System.Boolean CareAboutSavegameMissing, System.Boolean CareAboutLackOfMetadata) [0x00090] in <840a78b1269f4ce59e1c34693ecb56d9>:0
  at System.Environment.get_StackTrace () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at Arcen.Universal.ArcenDebugging.ArcenDebugLog (System.String Message, Arcen.Universal.Verbosity Verbosity) [0x00000] in <840a78b1269f4ce59e1c34693ecb56d9>:0
  at Arcen.Universal.World.DeleteSaveGame (System.String FullSaveName, System.Boolean CareAboutSavegameMissing, System.Boolean CareAboutLackOfMetadata) [0x00000] in <840a78b1269f4ce59e1c34693ecb56d9>:0
  at Arcen.AIW2.External.GameCommand_DeleteAllSaveGames.Execute (Arcen.AIW2.Core.GameCommand command, Arcen.AIW2.Core.ArcenClientOrHostSimContextCore context) [0x00000] in <75d536c604b04641852191e40f05f82b>:0
  at Arcen.AIW2.Core.GameCommand.Execute (Arcen.AIW2.Core.ArcenClientOrHostSimContextCore Context) [0x00000] in <72c5c87e2a7e4f629085b0e967b53d8a>:0
  at Arcen.AIW2.Core.World_AIW2.OnClientOrHost_ExecuteGameCommandsThatWereScheduled (Arcen.AIW2.Core.ArcenClientOrHostSimContextCore Context) [0x00000] in <72c5c87e2a7e4f629085b0e967b53d8a>:0
  at Arcen.AIW2.External.SimPlannerImplementation.ProcessCoreLogicForArbitraryFrameOnMainThread (System.Boolean& stalledWaitingOnConnections, System.Boolean& mayUpdateVisuals, System.String& reasonForNoVisualUpdates) [0x00000] in <75d536c604b04641852191e40f05f82b>:0
  at Arcen.AIW2.Core.Engine_AIW2.<ProcessArbitraryFrameOnMainThread>b__75_0 () [0x00000] in <72c5c87e2a7e4f629085b0e967b53d8a>:0
  at Arcen.Universal.ArcenThreading+<>c__DisplayClass11_0.<RunTaskOnBackgroundThread>b__0 () [0x00000] in <840a78b1269f4ce59e1c34693ecb56d9>:0
  at System.Threading.Tasks.Task.InnerInvoke () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Threading.Tasks.Task.Execute () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Threading.Tasks.Task.ExecutionContextCallback (System.Object obj) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Threading.Tasks.Task.ExecuteWithThreadLocal (System.Threading.Tasks.Task& currentTaskSlot) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Threading.Tasks.Task.ExecuteEntry (System.Boolean bPreventDoubleExecution) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
TagsNo tags attached.

Activities

BadgerBadger

Mar 8, 2022 11:59 pm

manager   ~0065275

What are the permissions on that file?

henry700

Mar 9, 2022 9:26 am

reporter   ~0065288

More specifically, this can be solved using FileShare.Delete modifier https://docs.microsoft.com/en-us/dotnet/api/system.io.fileshare?view=net-6.0#fields using this overload of File.Open: https://docs.microsoft.com/en-us/dotnet/api/system.io.file.open?view=net-6.0#system-io-file-open(system-string-system-io-filemode-system-io-fileaccess-system-io-fileshare)

henry700

Mar 9, 2022 9:26 am

reporter   ~0065289

Will check the permissions, didn't see your comment. Brb

henry700

Mar 9, 2022 9:30 am

reporter   ~0065290

Normal inherited apparently, owner can do whatever, admins can write, users can read
image.png (36,936 bytes)   
image.png (36,936 bytes)   

Chris_McElligottPark

Mar 10, 2022 1:23 pm

administrator   ~0065364

Thanks!

* When the game is trying to delete a file (such as in ironman) and runs into a sharing error, it now gives you a better error message. The TLDR is that you probably need to try again later, because some other process has locked the file (typically an OS backup, or Steam Cloud Saves, or similar). This is all mentioned now in the popup that happens.
** For good measure, also adjusted the file share rights that the program requests for some operations to be more permissive, since there were still a few places that were not explicitly doing that. We just don't want to accidentally be the ones locking ourselves out of our own file for a bit. Not likely that is what was happening, but always a possibility.

BadgerBadger

Mar 10, 2022 2:19 pm

manager   ~0065368

Windows uses mandatory locks?! Ugh

Chris_McElligottPark

Mar 10, 2022 3:27 pm

administrator   ~0065369

Windows uses optional locks, relax, haha -- some features it's not clear if the lock is default on, though. Windows is just unix for these last 22 years or so.

henry700

Mar 15, 2022 1:28 pm

reporter   ~0065432

Last edited: Mar 15, 2022 1:29 pm

-- check next note --

henry700

Mar 15, 2022 1:29 pm

reporter   ~0065433

The message is better but this is still happening in the foreground, any chance the popup could at least be hidden from the player in the case of this specific error and the task is rescheduled to some background thread, or something similar? If no ok, but it's still kind of odd as-is.

Issue History

Date Modified Username Field Change
Mar 8, 2022 10:27 pm henry700 New Issue
Mar 8, 2022 11:59 pm BadgerBadger Note Added: 0065275
Mar 9, 2022 9:26 am henry700 Note Added: 0065288
Mar 9, 2022 9:26 am henry700 Note Added: 0065289
Mar 9, 2022 9:30 am henry700 Note Added: 0065290
Mar 9, 2022 9:30 am henry700 File Added: image.png
Mar 10, 2022 1:23 pm Chris_McElligottPark Assigned To => Chris_McElligottPark
Mar 10, 2022 1:23 pm Chris_McElligottPark Status new => resolved
Mar 10, 2022 1:23 pm Chris_McElligottPark Resolution open => fixed
Mar 10, 2022 1:23 pm Chris_McElligottPark Fixed in Version => 4.004 Easy There, Hack Response
Mar 10, 2022 1:23 pm Chris_McElligottPark Note Added: 0065364
Mar 10, 2022 2:19 pm BadgerBadger Note Added: 0065368
Mar 10, 2022 3:27 pm Chris_McElligottPark Note Added: 0065369
Mar 15, 2022 1:28 pm henry700 Note Added: 0065432
Mar 15, 2022 1:28 pm henry700 Note Edited: 0065432
Mar 15, 2022 1:29 pm henry700 Status resolved => feedback
Mar 15, 2022 1:29 pm henry700 Resolution fixed => reopened
Mar 15, 2022 1:29 pm henry700 Note Added: 0065433
Mar 15, 2022 1:29 pm henry700 Note Edited: 0065432