Unable to perform mandatory yield Error
complete
WolfGang Senizen
A script in luau can be running something in a place that i cannot yield apparently.
This can crash the script in places it really shouldn't especially tight loops.
local text = "1,2,3"
for i=1,100000,1 do
text:match("([^,]+),([^,]+),([^,]+)")
end
Reliably throws
Object [script:New Script] Script run-time error
Unable to perform mandatory yield
[C] function match
This script is a basic example that can trigger it.
This can be caught with pcall... but it'd be nice if we didn't have too
function test()
local text = "1,2,3"
for i=1,100000,1 do
text:match("([^,]+),([^,]+),([^,]+)")
end
end
ll.OwnerSay("Script Starts")
pcall(test)
ll.OwnerSay("Script Continues")
Log In
Signal Linden
marked this post as
complete
Fixed in the latest update! The test script now takes a few seconds to run but completes. Thanks for the write-up and examples.
WolfGang Senizen
Signal Linden
Yeh I suspect it would take a while to run.
I was testing speed when I found it and it was taking about 1 second at
10,000
when I could get it to complete. So about 9 seconds for 100,000
is no performance loss and it works now š.Signal Linden
marked this post as
tracked
Linked to an internal issue where we are tracking the same issue, but triggered by
gsub
. Thanks for the write-up!