Calling TextChannel:SendAsync() too fast causes an unexpected crash

Detailed description
On complete accident, I put a TextChannel:SendAsync() call inside a TextChannel.OnIncomingMessage callback without a sanity check to make sure that it doesn’t recursively call. I expected an error to be raised or something to happen that would block this. Nothing did except an initial error when I sent a message in chat that said “cannot resume non-suspended coroutine”. I sent a message in chat again and then the crash occurred.

Where it happens
Roblox Studio and Player

When it happens
2024-08-20T05:01:26.000Z

Videos and images



Reproduction instructions and files

  1. Create a LocalScript under StarterCharacterScripts
  2. Insert this exact code into the script
local TextChatService = game:GetService("TextChatService")

TextChatService.OnIncomingMessage = function()
  TextChatService["TextChannels"]["RBXGeneral"]:SendAsync("This will crash the game!")
end
  1. Play the game and send a message in chat.
  2. The game will crash without any warning

Minimum reproduction place and video
BugReport1.rbxl (52.3 KB)

Program dump and log files

https://devforum.roblox.com/t/calling-textchannelsendasync-too-fast-causes-an-unexpected-crash/3098905

Isn’t this supposed to happen just like if you make a while loop without yielding?

2 Likes

Is it in a loop?

exceedchar30characters

When SendAsync is called, OnIncomingMessage gets called in return, meaning this creates an infinite loop

1 Like

Yes. I’m not sure why this causes a full on crash which is why I opened this.

An infinite loop is made. See hed’s answer

i don’t see how this is any different to running repeat until false or connecting a bindableevent with a function that fires the same event, it seems pretty expected to me

2 Likes

Same reason as any other sort of “infinite” loop would crash

Thanks for the report! We’ll follow up when we have an update for you.