Jump to content

Help deciphering the output_log?


Recommended Posts

Hi, can anyone help me understand what this error from outputlog is about? It happened at new cycle save. My first guess would be out of RAM, but it doesn't hurt to ask :)

[22:14:33.595] [1] [INFO] Error occurred with mods active. Disabling all mods.
OutOfMemoryException: Out of memory
  at (wrapper managed-to-native) object:__icall_wrapper_mono_array_new_specific (intptr,int)
  at System.IO.MemoryStream..ctor (Int32 capacity) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.IO.MemoryStream:.ctor (int)
  at SaveLoader.CompressContents (System.Byte[] uncompressed, Int32 length) [0x00000] in <filename unknown>:0 
  at SaveLoader.Save (System.String filename, Boolean isAutoSave, Boolean updateSavePointer) [0x00000] in <filename unknown>:0 
  at Game+<DelayedSave>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in <filename unknown>:0 

 

Link to comment
Share on other sites

Its a memory problem, but not necessarily RAM related. Its a 32bit integer, which means a digit with 32 bit aka 2^32. If this is full, the value changes to invalid and the system crashs. Its like bottle with 32 liters. If you fill in exactly 32 liters, everyhing is fine. If you want to fill in more, the bottle overflows. 

In your case, something is called in an int32 value, but is to big for that. But i cant make out whats causing it, because the rest of the log is missing.

Link to comment
Share on other sites

I don't think it is an int overflow, like SharraShimada said. 

When an Int32 Overflow happens, its value turn from positive to negative. This code produces an overflow:

        static void Main(string[] args)
        {
            int a = Int32.MaxValue;
            Console.Out.WriteLine(a);
            a = a + 1;
            Console.Out.WriteLine(a);
        }

The output is:
2147483647
-2147483648

Press any key to continue...

The only integer in the log is a Int32 length in at System.IO.MemoryStream..ctor (Int32 capacity).

If i it was an overflow in the Int32 Capacity, capacity variable would contain a negative value, emiting a System.ArgumentOutOfRangeException instead an OutOfMemoryException.

The capacity variable sets how many bytes that MemoryStream will have pre-allocated, so if thete is not enough memory, an out of memory exception will occur.

Two possibilities here: 
1) Your computer doesn't have enough ram to run ONI.
2) If there is some mod installed, it must have some programming error (bug) that create a circular reference when serializing the object state.

 

Link to comment
Share on other sites

3 hours ago, SharraShimada said:

But i cant make out whats causing it, because the rest of the log is missing.

I could have said the same thing. Your post is good as it is because it highlights the problem, but it's generally a good idea to include the entire log in case the problem is elsewhere. When the cause is unknown, it's also unknown which lines from the log file will be needed.

I will not rule out that the log isn't telling which mod caused this, but we can't really tell without access to the entire log.

Link to comment
Share on other sites

4 hours ago, fredhp said:

2) If there is some mod installed, it must have some programming error (bug) that create a circular reference when serializing the object state.

That sounds pretty likely. When doing the save, the target gets compresses in memory (it seems) and that would overflow on that circular reference if there are no extra measures to allow crawling circular references. Basically the savegame grows to infinity and at some time there is no memory available anymore to store it before writing it to file. Usually, you do not need to be able to dump (serialize) circular references, you just use back-references that are not followed on dumping.  Also, being able to dump circular references creates extra effort, so the functionality is quite likely not there.

Link to comment
Share on other sites

I would like to know when it makes sense to have a circular reference in the savegames. It sounds to me like somebody is saving something, which shouldn't be saved. Take for instance this line from my coal generator mod:

[MyCmpGet]
private CoalManualDeliveryKG delivery;

It's a reference to a CoalManualDeliveryKG component. The MyCmpGet keyword means it will on creation make it a reference to a component of that type. This grants access to that component, but it's not saved. It's automatically regenerated on load. Now if the delivery component needs access to the controller (it doens't in this specific case, but that's besides the point) it can add a similar declaration. They can then access data from each other without any issues and since none of them are saved, there is no circular reference in the savegame. With a setup like this, each component is responsible for saving itself, but no component is responsible for saving other components.

I'm actually fairly interested in knowing which mod caused this because I want to read the source code, which can cause a circular reference in a savegame.

Link to comment
Share on other sites

What this log is saying is that your system runs out of memory while trying to save, and it is due to mods. There seems to be a bug in one of your mods. Try disabling all and enabling them one by one to find out which one it is.

Link to comment
Share on other sites

It doesn't look like it's the same log file though. It doesn't mention OutOfMemoryException. The log is however full of warnings, which I'm clueless about. It looks really weird. You have a problem with StationaryChoreRangeVisualizer and unsubscribing to OnRotated and OnSelected events as well as some other event unsubscriptions. You also have 8 cells with non-zero mass, but 0 temperature.

I have no idea how you could end up with a problem like that, but I suspect corrupted data in the savegame. That would then bring up the question: how did you manage to corrupt the savegame?

Looking at the mod list, the only mod where I know the source code is High Flow Storage and I can tell for certain that it's not using the events in question and it doesn't affect temperature either. You have 3 mods to flip/rotate buildings, which is suspicious considering OnRotated is an issue, but I'm far from certain that those mods are to blame. Most likely they just change the rotate rule setting in BuildingDef, which should be safe. The rest of the mods shouldn't really be an issue either.

I can't really tell what your problem is. Maybe try using Better Mod Load Logs.

Link to comment
Share on other sites

4 hours ago, Nightinggale said:

You also have 8 cells with non-zero mass, but 0 temperature.

I can see that they have an identifier like 93056 - how do I find these tiles? Is it like counting from left to right, top to bottom? Or other naming scheme?

Link to comment
Share on other sites

4 minutes ago, Tobruk said:

I can see that they have an identifier like 93056 - how do I find these tiles? Is it like counting from left to right, top to bottom? Or other naming scheme?

Looks like it's counting left to right, bottom to top, like in

6 7 8
3 4 5
0 1 2

The bottom left cell is 0, but the source code doesn't explicitly mention the map width. I think that's set in the map generator somewhere.

Isn't there some debug tool to get cell coordinates and index? It should be fairly easy to add and I'm sure Klei thought of adding that for their own debugging.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...