[Bug Report] Repeated removal and addition of a compoment with assigned mod component action exhausts net_smallbytearray


Muche
 Share

Recommended Posts

Adding a component to an entity checks all assigned mod component actions and adds them to modactioncomponents field, which is later used to fill actionreplica.modactioncomponents (net_smallbytearray).
Removing a component from an entity does not remove said actions from modactioncomponents field.
Adding the same component to the entity again adds duplicate component reference to modactioncomponents.
Repeating the removal and addition increases the field's size without limit, which net_smallbytearray can't hold and issues error Net array has 32 elements; exceeds maximum size of 31.

Thanks to @DejaVuZXY for noticing it and cooperation during investigation.

 

Steps to reproduce:

Enable (server) mod with this modmain.lua:

AddComponentAction("SCENE", "inspectable", function(inst, doer, actions, right) end)
AddComponentAction("SCENE", "workable", function(inst, doer, actions, right) end)
AddComponentAction("SCENE", "lootdropper", function(inst, doer, actions, right) end)

Join the world. Enter the following into the debug console:

e=c_find('evergreen'); dumptable(e.modactioncomponents)
e:RemoveComponent('inspectable'); e:AddComponent('inspectable'); dumptable(e.modactioncomponents)
e:RemoveComponent('inspectable'); e:AddComponent('inspectable'); dumptable(e.modactioncomponents)
e:RemoveComponent('inspectable'); e:AddComponent('inspectable'); dumptable(e.modactioncomponents)
e:RemoveComponent('inspectable'); e:AddComponent('inspectable'); dumptable(e.modactioncomponents)

Which produces:

    K:     Test3     V    table: 5B2B8868    
        K:     1     V:     1    
        K:     2     V:     2    
        K:     3     V:     3    
        K:     4     V:     1    
    K:     Test3     V    table: 5B2B8868    
        K:     1     V:     1    
        K:     2     V:     2    
        K:     3     V:     3    
        K:     4     V:     1    
        K:     5     V:     1    
    K:     Test3     V    table: 5B2B8868    
        K:     1     V:     1    
        K:     2     V:     2    
        K:     3     V:     3    
        K:     4     V:     1    
        K:     5     V:     1    
        K:     6     V:     1    
    K:     Test3     V    table: 5B2B8868    
        K:     1     V:     1    
        K:     2     V:     2    
        K:     3     V:     3    
        K:     4     V:     1    
        K:     5     V:     1    
        K:     6     V:     1    
        K:     7     V:     1    
    K:     Test3     V    table: 5B2B8868    
        K:     1     V:     1    
        K:     2     V:     2    
        K:     3     V:     3    
        K:     4     V:     1    
        K:     5     V:     1    
        K:     6     V:     1    
        K:     7     V:     1    
        K:     8     V:     1    

 


View full bug

  • Like 1
Link to comment
Share on other sites

I confirm this. Muche crafted some awesome scripts and eventually found out the bug.

When the server first starts up it's fine and no errors show in the log file. When the server keeps running for longer period of time, few hours or so, the error log is spammed and filled with these lines:

[15:38:32]: Error serializing lua state for entity evergreen[115605]
[15:38:32]: Net array has 68 elements; exceeds maximum size of 31
[15:38:32]: Error serializing lua state for entity evergreen[115335]
[15:38:32]: Net array has 67 elements; exceeds maximum size of 31
[15:38:32]: Error serializing lua state for entity evergreen[116092]
[15:38:34]: Net array has 68 elements; exceeds maximum size of 31
[15:38:34]: Error serializing lua state for entity evergreen[113608]
[15:38:35]: Net array has 68 elements; exceeds maximum size of 31
[15:38:35]: Error serializing lua state for entity deciduoustree[107169]
[15:38:36]: Net array has 62 elements; exceeds maximum size of 31

The longer the server runs, the more spam the error log receives. This is rather annoying bug.

  • Like 1
Link to comment
Share on other sites

Very important bug. I think that something is wrong with tag system in general. I mean that simple inst:AddTag and inst:RemoveTag may shift network data and cause random bugs. And I'm not sure how to reproduce these random bugs. I would meditate on the game code.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share