Jump to content

Help with Memory Stream Error


kronons

Recommended Posts

I need help. I am running a lot of modelts. My mod folder is 1.5 gb. I am getting this issue on my dedicated server. I've read and searched the forums. I tried to mod the assembly-csharp.dll file to no avail. So far nothing I've done has worked. Can anyone help me to get this modded to work with more mods? Thank you.

 

 

 

2019-02-18T06:35:23 151.781 EXC Cannot expand this MemoryStream
NotSupportedException: Cannot expand this MemoryStream
 at System.IO.MemoryStream.set_Capacity (Int32 value) [0x00000] in <filename unknown>:0 
 at System.IO.MemoryStream.Expand (Int32 newSize) [0x00000] in <filename unknown>:0 
 at System.IO.MemoryStream.Write (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in <filename unknown>:0 
 at Noemax.GZip.DeflateOutputStream+#pf.FlushOutput (System.Byte[] , Int32 , Int32 ) [0x00000] in <filename unknown>:0 
 at #c.#Mb.#ob () [0x00000] in <filename unknown>:0 
 at #c.#Mb.#cb (System.Byte* , System.Byte* , Int32 ) [0x00000] in <filename unknown>:0 
 at #c.#Mb.#7 (Int32 ) [0x00000] in <filename unknown>:0 
 at #c.#Mb.#7 (#c.#Mb , Int32 ) [0x00000] in <filename unknown>:0 
 at #c.#Mb.deflate (Int32 ) [0x00000] in <filename unknown>:0 
 at Noemax.GZip.DeflateOutputStream.Write (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in <filename unknown>:0 
 at Utils.StreamCopy (System.IO.Stream _source, System.IO.Stream _destination, System.Byte[] _tempBuf, Boolean _bFlush) [0x00000] in <filename unknown>:0 
 at NetConnectionSimple.taskSerialize (.ThreadInfo _threadInfo) [0x00000] in <filename unknown>:0 
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
Logger:masterLogException(Exception)
Logger:Exception(Exception)
Log:Exception(Exception)
NetConnectionSimple:taskSerialize(ThreadInfo)
ThreadManager:myThreadInvoke(Object)

Link to comment
Share on other sites

Need the whole log, or at least several lines above that. That is telling us there is a problem with a memory stream but not what memory stream. Its the same with NREs. It lists what it was trying to do several lines above the actual error. If the log is too big, you can either use pastbin or post everything that is above that line. Should help shed some light on the issue. Or there is the pain staking move all the mods out of your mod folder and add them in one by one until you get the error. Not a fun option if you have a lot of mods considering how long it takes to load a game to test.

Link to comment
Share on other sites

I know what I am doing and I write my own mods. I've also researched and tried different solution. Maybe I should of asked if someone can show me what to modify in the assembly-csharp.dll to fix this issue. Or if there is a different solution. Thanks. Below is the full log file. Nothing out of the ordinary. Loads fine and server starts. Only issue when user tries to log into server. I am still pretty sure it has to do with the stream buffer which I need to modify. But the assembly-csharp.dll has changed a lot over the iterations and the ones posted on this forum to fix is not compatible anymore. I even disassemble the custom ones to see the change in code. Any help is appreciated.

 

[ATTACH]27677[/ATTACH]

output_log.txt

Link to comment
Share on other sites

Does the person/s joining habe the mods on their end installed to or.

 

Yes, I am the owner and developer of the mods. I have everything installed on both sides.

 

Here is a reference to past issues. I have the same exact issue. I don't understand why TFP doesn't allocate memory dynamically IMO.

 

https://7daystodie.com/forums/showthread.php?32739-Bug-NotSupportedException-Cannot-expand-this-MemoryStream&highlight=memory+stream

Link to comment
Share on other sites

Everything looks like it is loading properly and with 64 gigs of ram, it is likely not the server so it does look like an engine issue. You could try removing one or two of the more resource intensive mods like mumphys just to see if it then loads. I've never really messed with the dlls so I am not sure if there is a way to allocate more ram vram for it.

Link to comment
Share on other sites

Yea if I remove the farming mod it'll work just fine. I'm pretty sure it has to do with the max set of items in the items.xml. Still trying to figure out if I can expand it so I can have more items. If all else fails I'll have to use less mods until someone can help me with a soluation.

Link to comment
Share on other sites

<!-- Item limit: There can be 32k items in the game. IDs are generated internally on loading the game/items. -->

<!-- Block limit: There can be 32k blocks in the game. 0-255 are reserved for air/terrain blocks.

IDs are generated internally on loading the game/blocks/items (1 byte for terrain, 2 for the rest). -->

Link to comment
Share on other sites

<!-- Item limit: There can be 32k items in the game. IDs are generated internally on loading the game/items. -->

<!-- Block limit: There can be 32k blocks in the game. 0-255 are reserved for air/terrain blocks.

IDs are generated internally on loading the game/blocks/items (1 byte for terrain, 2 for the rest). -->

 

Thanks for the information. The question is can we increase the transfer of server files to client with the 32k items and blocks. I think the issue is the buffer in which is used has to store the items and blocks temporarily until it is all sent to the client. But the issue is the buffer is too small. So the server errors out since it can't store all the items and blocks in the buffer to send to the client.

 

Now does anyone know how to modify the .dll to allow more allocation of buffer memory. It has been done before. But I can't figure out to how to do it in alpha 17.

 

https://7daystodie.com/forums/showthread.php?32739-Bug-NotSupportedException-Cannot-expand-this-MemoryStream&highlight=memory+stream

Link to comment
Share on other sites

Yes, I am the owner and developer of the mods. I have everything installed on both sides.

 

Here is a reference to past issues. I have the same exact issue. I don't understand why TFP doesn't allocate memory dynamically IMO.

 

https://7daystodie.com/forums/showthread.php?32739-Bug-NotSupportedException-Cannot-expand-this-MemoryStream&highlight=memory+stream

 

I meant the player joining your server (not including you lol) does that playwr habe your mods on their end

Link to comment
Share on other sites

I meant the player joining your server (not including you lol) does that playwr habe your mods on their end

 

Yes they try to join and get the same error. I try to join same error. It has to be the buffer size that is causing this. Do you have any idea on how to increase the buffer size?

Link to comment
Share on other sites

So I did some more digging. I found some lines of code.

 

public static int MAX_BLOCKS = 32768;

 

And

 

public static int MAX_ITEMS = 2 * Block.MAX_BLOCKS;

 

Does anyone know how to modify the .dll files? I think if we double the about of max_blocks it would fix the issue. Any help would be appreciated.

 

Btw I tried to load up the server. Everything works if I limit the amount of blocks and items. In my case I believe I am trying to load more than 32768 blocks. If I remove the mods that adds blocks it works fine. I'm not sure if the memorystream needs to be increased or the max_blocks. Or both??

Link to comment
Share on other sites

number of blocks and items cant be increased without code rewrite, because itemid is stored in 16bit unsigned integer and blockid is is stored in 15bit of 32bit unsigned integer with other data in 17bit.

without masssive code rewrite is it not possible.

2 mb is max. of memorystream.

 

Thank you. That is good to know. I understand now. It is probably the size of the xml files exceeding the 2mb max. Which I find very limiting. And I don't think it is a massive code rewrite. It's a matter of changing the data type and increasing the buffer.

 

I.e. in this post they were able to increase the buffer size. Not a massive code rewrite. Just modifying an existing variable value.

 

https://7daystodie.com/forums/showthread.php?32739-Bug-NotSupportedException-Cannot-expand-this-MemoryStream&highlight=memory+stream

Link to comment
Share on other sites

Does anyone have any idea?? I'm trying to load both farming mods and it throws the memory stream error. I'm not sure if it is the size of the buffer, the number of block, number of items, all the above? If anyone can help thank you!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...