Author Topic: Null Pointer & OutOfMemory Exceptions While Saving or Area Transitions [w/ logs]  (Read 1432 times)

communistsquirrel

  • Probably not a Spambot
  • *
  • Posts: 16
  • Karma: +1/-0
    • View Profile
Hi. I registered here just to report two software defects I found while playing the release version of the game, 1.0.0.5.

I believe these issues to be related to each other, and possibly related to having many save game files in the saves directory, as both issues occurred when I tried to save, quicksave, or during an autosave. I had 1.88 GB worth of save files in the save games directory (171 save directories). I archived my save files and moved them out of the saves directory, which I suspect may allow me to continue playing.

The first issue, which seems to be more severe, leads to a crash to desktop. This issue occurred more recently when I tried to quicksave in one of the cave maps. I do not have an indication the map was to blame, as I had already successfully saved on that map previously. Looks like a NPE when referencing a TimeSpan object in the (obfuscated?) ah2 object, function m. Here is the stack trace:
Code: [Select]
System.NullReferenceException: Object reference not set to an instance of an object.
   at ah2.m()
   at mp.ny(TimeSpan A_0, TimeSpan A_1)
   at b4w.g(TimeSpan A_0, TimeSpan A_1)
   at b6v.ny(TimeSpan A_0, TimeSpan A_1)
   at b4w.g(TimeSpan A_0, TimeSpan A_1)
   at bpy.a(TimeSpan A_0, TimeSpan A_1)
   at ako.a(akk A_0)
   at a6n.g5(akk A_0)
   at al5.g5(akk A_0)
   at d7.a(akk A_0)
   at aa2.Update(GameTime gameTime)
   at gr.Update(GameTime gameTime)
   at Microsoft.Xna.Framework.Game.Tick()
   at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
   at Microsoft.Xna.Framework.GameHost.OnIdle()
   at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()
   at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
   at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at Microsoft.Xna.Framework.WindowsGameHost.Run()
   at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
   at bcm.a(String[] A_0)

The second issue occurred a few days ago when I was transitioning between maps outside SGS (IIRC). I believe this occurred during an autosave before loading the next map. Looks like a hash map resize operation failed to grab more memory from the heap when adding KVPs to a serialization map during a save routine. Is this map being garbage collected/deallocated after each save? Should it?  :-\  My system has 4x+ the recommended system requirements to run the game, and I don't believe the game is attempting to use more than 4GB of RAM, if that (32 bit executable?). I see 500MB on average, but after leaving the game running for about 10 hours, there is some minor performance degradation. There may be slow memory leaks that contribute to these errors, but I do not know for sure.
Code: [Select]
System.Exception: Failed to load locale 'LU-A1 - Lower Underrail'. ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.Collections.Generic.Dictionary`2.Resize(Int32 newSize, Boolean forceNewHashCodes)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Runtime.Serialization.SerializationInfo.AddValueInternal(String name, Object value, Type type)
   at System.Runtime.Serialization.SerializationInfo.AddValue(String name, Object value, Type type)
   at System.Runtime.Serialization.SerializationInfo.AddValue(String name, Object value)
   at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseMember(ParseRecord pr)
   at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Parse(ParseRecord pr)
   at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadMemberReference()
   at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
   at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
   at ai.DeserializeFromBinaryInternal[T](Stream stream, SerializationBinder binder, Int64 dataModelVersion)
   at ai.DeserializeFromBinaryFileCompressed[T](String filePath, SerializationBinder binder, Boolean tryToRetrieveDataModelVersion)
   at ako.a(String A_0)
   at azq.yz(fg A_0, Boolean A_1)
   --- End of inner exception stack trace ---
   at cfm.LogAndThrow[T](Exception innerException, LogSeverity severity, String message, Object[] messageArgs)
   at azq.yz(fg A_0, Boolean A_1)
   at bez.adg(Boolean A_0, Boolean A_1)
   at a2c.xs(akk A_0)
   at zx.e(akk A_0)
   at bbr.a(akk A_0)
   at bbr.b(akk A_0)
   at bbr.cz(akk A_0)
   at zx.g(akk A_0)

After this OOM exception problem, the game did not crash, but kicked me back to the main menu, where I was unable to load a recent game. I restarted the game, and was able to continue playing with no further issues (until the above NPE).

I believe these problems will temporarily be alleviated by removing save files from the save game directory, because both issues appear to be related to saving the game state, specifically allocating resources during the save operation, and these errors only cropped up after I had accumulated a significant amount of data in the saves directory.

You may want to look into what is being loaded into memory during a save operation. The game probably does not need to load any existing save data into memory for a quicksave, or autosave, and only the top 10 or so need be loaded for the manual save UI, with more being loaded conditionally as the user scrolls down the list of saves. Just my 2 cents.

Thanks for making a great game!
« Last Edit: December 29, 2015, 04:27:29 am by communistsquirrel »

communistsquirrel

  • Probably not a Spambot
  • *
  • Posts: 16
  • Karma: +1/-0
    • View Profile
I was in one of the cave areas (see screenshots). Basically, I loaded in from the northwest zone entrance, used Pseudo-Spatial Projection, and Exothermic Aura out of combat, and then ran around the northern area until some of the crawlers in the area attacked. I killed 4 of the crawlers this way, perhaps exiting combat and repeating once to use Aura again. I then stopped, out of combat, in the area in the middle near the pool, and used quicksave. Then, there was a error dialogue saying the game could not be saved. I can't remember if the game crashed then, or if I tried to load the area's autosave and that caused the crash. I was not able to recreate this (I tried, and had no problems with the area after restarting the game).

Screenshots

Maybe a timer problem on the fire sprite animation tics for Exothermic Aura? The flames were still active on the ground when I went to save.

Edit: Glad to hear you guys are on top of things.
« Last Edit: December 29, 2015, 06:11:40 am by communistsquirrel »