1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

KAG Bad Delta / MSG_INVENTORY_PUTIN + Network ID for Blobs

Discussion in 'Server Help' started by TFlippy, Nov 20, 2016.

  1. Kasper123

    Kasper123 Base Burner

    Messages:
    22
    But is dis related to what this thread is about though?
    I only posted it because of what geti said:
    onHit must run exacly the same number if times on both server and client.
    I understood it that onHit was somewhat related to damage.
    As for the mine fast traveling, ill try to get video of me being killed or killing someone with it.
    Sorry if im interrupting, thought there was a chance this could help.

    -Shadow Blade Kasper
     
  2. TFlippy

    TFlippy Arsonist Tester

    Messages:
    87
    Seems that the bad deltas also happen on the server. Also, the mass DC on map change only happens when there's too many players on the server - it was fine when I changed the map with only 2 people on.
    --- Double Post Merged, Dec 4, 2016, Original Post Date: Dec 3, 2016 ---
    @Geti Could you possibly add a way to ignore the bad deltas, so it wouldn't kick the players? While it's not a fix, it will at least deal with the players getting disconnected.
    Here's a server log in case you're intersted, stripped off sent files and other unnecessary garbage. It ended a server crash.
     
    Last edited: Dec 4, 2016
  3. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    There's no way to ignore them - they're detected when the network stream is decoded badly (ie there's data left over, or it runs out of data too early), and that can only be found out after-the-fact; the only way to ignore it would be to have a global "roll back" system at a component level, and that's a bit outside scope.
    It's a symptom of an erroneous packet or bad packet read-write code, which is why I warned about onHit issues (onHit forms part of the protocol, and it's a common mistake and is showing up in your logs).

    I'll check out the new log later on, but I'm not yet convinced there isn't an issue on your end since bad deltas are very infrequent on officials whereas it seems to be happening constantly with your mod.
     
  4. TFlippy

    TFlippy Arsonist Tester

    Messages:
    87
    Not exactly ignoring them, but rather not kicking the player when the fail counter runs reaches 1, such as in "[15:46:28] Bad snapshot; skipping 30656b fail 49 (last packet 52 once 72 debug mat_oil)".
    I've also filtered out the logs, and it turns out that the "bad snapshot" is most frequently happening on classes (knight, bandit, builder, peasant), with couple of errors also occuring on materials and even gamemode's rules.

    Here are collections of the errors from today's client logs.
    Bad Snapshot
    PACKET_SNAPSHOT_ONCE_PROPERTY_CREATE
    MSG_INVENTORY_PUTIN
    OnHit
    --- Double Post Merged, Dec 4, 2016, Original Post Date: Dec 4, 2016 ---
    Could this be caused by high network traffic, aside from the onHit returning different values on the client and server?
     
  5. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    You'll get all sorts of errors, because the point after the "bad delta" or snapshot or whatever will cause the rest of the packet to be incorrectly decoded as well, leading to all sorts of stupid errors.

    I dont think it could be caused by high network traffic - it could be caused by anything violating the network protocol though; onSendCreateData/onReceiveCreateData, onCommand might be able to cause it, the onHit thing will definitely cause problems.

    A common problem with custom createdata and commands is assuming that a count will never exceed 255, storing the value in a u8, and then getting an overflow when it does and failing to properly decode your data, screwing up everyone else's data.

    Re: onhit - it's not just "different values" - its a mismatch in the amount of times it's run - if one script is ONLY on the server or client (ie it's got #define SERVER_ONLY or CLIENT_ONLY or you used AddScript only on one or the other), this causes a bug.
    Different values shouldn't cause this particular issue, though it will cause other issues :)

    I'll tell MM about this thread but I'm not sure how interested he'll be.

    Edit: I've checked and the network IDs do indeed wrap around and are checked for clashes with existing network IDs.
     
    Last edited: Dec 4, 2016
  6. Pirate-Rob

    Pirate-Rob Haxor Staff Alumni Tester

    Messages:
    270
    So any variable that is .Sync()ed could cause a bad delta then if it overflows?
     
  7. TFlippy

    TFlippy Arsonist Tester

    Messages:
    87
    Turns out that a custom !addbot chat command definitely causes bad deltas.

    Code:
    if (cmd == this.getCommandID("addbot"))
    {
            string botName;
            string botDisplayName;
    
            if (!params.saferead_string(botName)) return;
    
    
            if(!params.saferead_string(botDisplayName)) return;
    
            CPlayer@ bot = AddBot(botName);
            bot.server_setCharacterName(botDisplayName);
    }
    
    After the bot spawns, console will start spewing bad delta errors about random objects. I'll try looking onto the player spawning code. (Bot is called Derpo)
    The spam continues until the client reconnects or gets disconnected.

    [​IMG]
    --- Double Post Merged, Dec 5, 2016, Original Post Date: Dec 5, 2016 ---
    I may have fixed it. I looked through my old logs to see when did the bad deltas started occuring - apparently it was caused by a screw up while respawning players.
     
  8. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    Uh no, but if you send a custom createdata with say an "array" of elements, and you store the length of that array as a u8, then if that array has >255 elements, that will fail to decode properly.

    Cool! I'd be quite interested in what the mistake was!
     
  9. TFlippy

    TFlippy Arsonist Tester

    Messages:
    87
    It involved using a custom struct and saving player data when they leave the server.
    Anyway, it seems to have helped a bit, as it's less frequent, but it still does happen on nextmap. Would it be possible to make make the bad delta message display the name of the script that causes the error, instead of the blob?

    Also, the server now crashes much more often. Not sure whether it's related to my fix, or the latest KAG update, as I just commented out a somewhat standalone feature.
    --- Double Post Merged, Dec 7, 2016, Original Post Date: Dec 7, 2016 ---
    For some reason, I'm still getting the "hits count mismatch" error. I checked all of the scripts on these blobs, but haven't found anything wrong. Sometimes it also happens on the Fishy. Could it be caused by edited base KAG scripts (they're in the mod folder, but at different paths).

    [​IMG]
     
  10. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    Dont think so, as I said it's only detected upon a delta "going wrong" after the fact - it's impossible to tell until you're at the end of the packet afaik. If it would be, it's something for MM to look into, not myself I'm afraid.

    Maybe. Given how flaky it's been in the past I'd probably go with custom filenames; it's the kind of thing that "might be fixed, one day" but I wouldn't bet much on it.

    Sorry for the disappointing answers.

    Hopefully the patch this afternoon helped a little? It shouldn't lock up any more.
     
  11. Vamist

    Vamist THD Team THD Team Tester

    Messages:
    544
    So, joined TC to go to next map,

    I get disconnected, everybody else is still fine

    Code:
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1177 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1176 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1175 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1174 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1173 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1172 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1171 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1170 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1169 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1165 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1160 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1158 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1157 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1154 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1152 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1151 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1150 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1144 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1143 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1141 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1140 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 1138 - ladder]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 714 - rifle]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 674 - chicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 674 - chicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 674 - chicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 674 - chicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 660 - chicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 660 - chicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 660 - chicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 660 - chicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 660 - chicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 660 - chicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 660 - chicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 660 - chicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 660 - chicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 660 - chicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 580 - scoutchicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 580 - scoutchicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 580 - scoutchicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 580 - scoutchicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 580 - scoutchicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 580 - scoutchicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 580 - scoutchicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 580 - scoutchicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 580 - scoutchicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 580 - scoutchicken]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 539 - merchant]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 539 - merchant]
    [22:40:11] MSG_INVENTORY_PUTIN: Couldn't find inventory blob, wasn't it yet created? [my id 539 - merchant]

    Thats what caused me to leave.
     
  12. TFlippy

    TFlippy Arsonist Tester

    Messages:
    87
    Apparently the bad deltas are also caused by reading non-existent data from a network stream in commands. I removed a line that wrote player's network ID to a stream, but forgot to get rid of the one that read it on the other side.
     
  13. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
     
  14. Olimarrex

    Olimarrex Ballista Bolt Thrower Official Server Admin

    Messages:
    177
    I also got some bad delta issues whilst trying to create an extra map for an assault courses mod. Would it help if I posted what seems to be happening?
     
  15. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    Sure, but it's probably a bug in the gamemode code there that your map brings out. More info is better though. Could be worth moving to another thread though.
     
  16. Olimarrex

    Olimarrex Ballista Bolt Thrower Official Server Admin

    Messages:
    177
    Hrmm, I'm not sure what I had changed that broke it, but it was definitely something with the game mode code. Thanks for the pointer.
     
    Biurza likes this.