Open murashkayt opened 3 years ago
That is a regex dos, also known as a regex denial of service.
Can you try commenting out https://github.com/PrismarineJS/mineflayer/blob/db8e6931740cca8300105dd32ef2a5dac5dcc416/lib/plugins/chat.js#L105? I believe the USERNAME_REGEX is causing the issue.
https://regexr.com/673s2 shows that many () causes the regex parsing to slow down heavily.
temporary workaround https://github.com/PrismarineJS/mineflayer/issues/2328#issuecomment-985246695
Versions
Detailed description of a problem
When a message with a large number of brackets is sent in the chat, the bot is overloaded and leaves the server after a minute.
What did you try yet?
Did you try any method from the API? No. Did you try any example? Any error from those? no.
Your current code
Expected behavior
No crashes
Additional context
vsc with minecraft this problem is observed not only on the vanilla server, but also on the spigot server.
here's a screenshot of the task manager when bot is overloaded
you can crash the bot by writing a lot of brackets in the chat. if the bot is running on someone else's computer, it is quite possible to overload the computer owner's system.
my friend told me that it is possible to fix this problem by writing
return
inlib/plugins/chat.js
after 121 lines. but this will cut the functionality of mineflayer and bot.chatAddPattern will not work.