Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENSURE ALL OF OUR MODS ACTUALLY UNLOAD #1350

Open
StarCoreIssueBot opened this issue Jul 9, 2024 · 6 comments
Open

ENSURE ALL OF OUR MODS ACTUALLY UNLOAD #1350

StarCoreIssueBot opened this issue Jul 9, 2024 · 6 comments
Labels
Bug-Report Something isn't working Dev-Related ease the suffering
Milestone

Comments

@StarCoreIssueBot
Copy link
Collaborator

damage events
network event
subscribing to block add
honestly a mass search for += -= would probably do it

Submitted by:

@StarCoreIssueBot StarCoreIssueBot added the Bug-Report Something isn't working label Jul 9, 2024
@InvalidArgument3 InvalidArgument3 added this to the TT 4.5 milestone Jul 9, 2024
@InvalidArgument3
Copy link
Contributor

4-07-25 12:30:40.532 - Thread:   1 ->  ERROR: Loading screen failed
2024-07-25 12:30:40.532 - Thread:   1 ->  Exception occurred: System.IO.IOException: The process cannot access the file 'C:\Users\Liam\AppData\Roaming\SpaceEngineers\Storage\3237212491.sbm_SwapperScripts\log.txt' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at VRage.FileSystem.MyFileSystem.OpenWrite(String path, FileMode mode)
   at Sandbox.ModAPI.MyAPIUtilities.VRage.Game.ModAPI.IMyUtilities.WriteFileInLocalStorage(String file, Type callingType)
   at Munashe.BlockSwapper.BlockSwapper_Session.LoadData()
   at Sandbox.Game.World.MySession.LoadComponent(MySessionComponentBase component)
   at Sandbox.Game.World.MySession.LoadDataComponents()
   at Sandbox.Game.World.MySession.PrepareBaseSession(MyObjectBuilder_Checkpoint checkpoint, MyObjectBuilder_Sector sector)
   at Sandbox.Game.World.MySession.LoadMultiplayer(MyObjectBuilder_World world, MyMultiplayerBase multiplayerSession)
   at System.DelegateExtensions.InvokeIfNotNull(Action handler)
   at Sandbox.Game.Gui.MyGuiScreenLoading.RunLoad()

i/o error from blockswapper, doubt it's related but indicative of something not being unsubscribbed

@InvalidArgument3 InvalidArgument3 added the Dev-Related ease the suffering label Jul 29, 2024
@InvalidArgument3
Copy link
Contributor

one error happened when a server auto restarted while connecting that might be a trigger

@InvalidArgument3
Copy link
Contributor

another one when unable to load on a server

2024-08-21 17:41:27.789 - Thread:   1 ->  Exception in Handler: System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at CoreSystems.Session.AssembleArmorDefinitions(ArmorDefinition[] armorDefs)
   at CoreSystems.Session.PickDef(ContainerDefinition baseDefArray)
   at CoreSystems.Session.Handler(Object o)
2024-08-21 17:41:28.050 - Thread:   1 ->  Error: Error during loading session:System.IO.IOException: The process cannot access the file 'C:\Users\User\AppData\Roaming\SpaceEngineers\Storage\3237212491.sbm_SwapperScripts\log.txt' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at VRage.FileSystem.MyFileSystem.OpenWrite(String path, FileMode mode)
   at Sandbox.ModAPI.MyAPIUtilities.VRage.Game.ModAPI.IMyUtilities.WriteFileInLocalStorage(String file, Type callingType)
   at Munashe.BlockSwapper.BlockSwapper_Session.LoadData()
   at Sandbox.Game.World.MySession.LoadComponent_Patch2(MySession this, MySessionComponentBase component)
   at Sandbox.Game.World.MySession.LoadDataComponents()
   at Sandbox.Game.World.MySession.PrepareBaseSession(MyObjectBuilder_Checkpoint checkpoint, MyObjectBuilder_Sector sector)
   at Sandbox.Game.World.MySession.Load_Patch1(String sessionPath, MyObjectBuilder_Checkpoint checkpoint, UInt64 checkpointSizeInBytes, Boolean saveLastStates, Boolean allowXml)
2024-08-21 17:41:28.050 - Thread:   1 ->  ERROR: Loading screen failed
2024-08-21 17:41:28.050 - Thread:   1 ->  Exception occurred: System.IO.IOException: The process cannot access the file 'C:\Users\User\AppData\Roaming\SpaceEngineers\Storage\3237212491.sbm_SwapperScripts\log.txt' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at VRage.FileSystem.MyFileSystem.OpenWrite(String path, FileMode mode)
   at Sandbox.ModAPI.MyAPIUtilities.VRage.Game.ModAPI.IMyUtilities.WriteFileInLocalStorage(String file, Type callingType)
   at Munashe.BlockSwapper.BlockSwapper_Session.LoadData()
   at Sandbox.Game.World.MySession.LoadComponent_Patch2(MySession this, MySessionComponentBase component)
   at Sandbox.Game.World.MySession.LoadDataComponents()
   at Sandbox.Game.World.MySession.PrepareBaseSession(MyObjectBuilder_Checkpoint checkpoint, MyObjectBuilder_Sector sector)
   at Sandbox.Game.World.MySession.Load_Patch1(String sessionPath, MyObjectBuilder_Checkpoint checkpoint, UInt64 checkpointSizeInBytes, Boolean saveLastStates, Boolean allowXml)
   at Sandbox.Game.World.MySessionLoader.<>c__DisplayClass18_0.<LoadSingleplayerSessionInternal>b__7()
   at System.DelegateExtensions.InvokeIfNotNull(Action handler)
   at Sandbox.Game.Gui.MyGuiScreenLoading.RunLoad()

@InvalidArgument3
Copy link
Contributor

a "fun" way to reproduce this (causing an error in loading) is to load the world, paste a planet, save it. delete the .vx2 entry from the save file. when loading back into it kicks you back out in the first 10% causing certain mods to get stuck, requiring a client reload to load back into any other world

@InvalidArgument3 InvalidArgument3 pinned this issue Oct 15, 2024
@InvalidArgument3 InvalidArgument3 changed the title ensure all of our mods that subscribe to events also unsubscribe if needed ENSURE ALL OF OUR MODS ACTUALLY UNLOAD Oct 15, 2024
@InvalidArgument3
Copy link
Contributor

InvalidArgument3 commented Oct 15, 2024

Starcore MT 2024-09-14 2359.zip
this world is a slightly older verison of starcoreMT but will get an error every time triggered by loading in, after which some sessioncomponent stays stuck on forever. found to be season_4_adjustments but the same doesn't happen on the starcoreMT world, so probably something with loading all of the grids. need to enact #1730

@InvalidArgument3
Copy link
Contributor

InvalidArgument3 commented Oct 26, 2024

i learned more about this. keen keeps the game in a zombie state if a mod fails to unload
"That means any I/O handles, any events, etc will not be properly disposed/unhooked if any error occurs during unloading. "

a debug plugin might be able to tell the game to fucking die. then, it can generate useful logs

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug-Report Something isn't working Dev-Related ease the suffering
Projects
Status: Backlog
Development

No branches or pull requests

2 participants