Skip to content

[BUG] Server crashes and weird behaviors with lot of denied chat messages and EventTimer #435

@my-name-is-samael

Description

@my-name-is-samael

Fill out general information
OS : Win11 Pro, RAM 32GB
Server Version: 3.4.1, also tested with 3.8.2

Describe the bug
I am experiencing issues when a lot of users are texting via in-game chat, server randomly restarts without any error nor warning (the last log line is the chat message).
I have a special config in my mod (I guess you know it well now 😅) and it denies every message with the return code 1 (in accordance to the documentation and the source code).

I did some testing spamming the chat with and without the message handler and event timer (I don't know C++ very well so I didn't look much further), and here are my observations:

without MessageHandler with MessageHandler
without EventTimer Runs fine (all messages shown) Runs fine (no message shown)
with EventTimer Runs fine (all messages shown) Crashes or becomes very slow (and few messages can be shown)

Basic scripts to reproduce:

-- ServerMessageReject.lua

DenyMessage = function()
    return 1
end
MP.RegisterEvent("onChatMessage", "DenyMessage")

function FastTick()
    --print("Fast tick") -- doesn't even need to be commented out to witness crash
end
MP.RegisterEvent("fastTick", "FastTick")
MP.CreateEventTimer("fastTick", 100)

Then with a connected client, you can enter this instruction in the game console:

for _=1,1000 do UI.chatSend(tostring(require "socket".gettime())) end

Expected behavior
In the best scenario, avoid crashes but an explanation of the reason would help too 😄

Additional informations
I know this client script is an extreme stress test, but I experience crashes with less than 5 players sending around 5 messages each within 30 secs with my heavy load mod 😅

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions