Eggs-D-Studios / wos-issues

Waste of Space bugs, suggestions, and other feedback
11 stars 0 forks source link

Microcontrollers throttling execution on basic scripts #259

Open 1-creare-1 opened 3 months ago

1-creare-1 commented 3 months ago

Guidelines

Version

Main (Production)

What happened? What did you expect to happen?

When running the following script (and similar scripts) the microntroller will throttle even though these scripts shouldn't be taking 100ms/tick

GetPart("Light"):SetColor(BrickColor.random().Color)

I've also noticed this happen to a lot of other short snippets of code and they all seem to share the common similarity of calling a method on a part like :SetColor or :Configure image

How can we reproduce this bug?

  1. Load this model:
    {"m":null,"t":"buffer","zbase64":"KLUv/WBNAl0MAKYQQDtAxSgdw051VWFRcOdg1VdsqopiWI58X+BID7ClXTLiOone9gK+bljbZcPMfzMyMtjqDzIIYXXbm2yZAi0AKwA1AA2z/xpKacY+zFMqlZo/oU6on1LKsbHN/5Pkn5Ffg78EAFOJdtJhevU/kf8mf1M2Nh+Cbc4VBGIn+scyzAoQgPDHfAL8/VZChXLJ2P+l5hrqP1Zt/RV8/T93u3jjLCwOmQWFqzMEq2VVKtkuj0QcBvWFFXU1A4uYAoI8EnEVlAODi0Ve8sHKQMymxWpZBTL2/ydfRdPxdDgfN9RV7PHYOAzi4Eu6WrYaEZ3NhpNxxciWAsKGrtaxgQFbEuni3AVDIMACseMOhDCBypqJrjfaakocSMqJ0LJLsuJ9L6okAfeewDHpiMsptTthV9QIc3iLh6TGq11UVITh287WJlkYLBu/j2dz3gD6ruDvINSf3ZQgWEPm2UgoQz8yaoRAsD1OtmILDl1DmV4Wa9vLF9zF3tVMjtEFagISG7eDDDUl4CIcwIiADuUE"}
  2. Open F9
  3. Click the microcontroller a couple times, observe the throttling warnings

Frequency

Always

Hexcede commented 3 months ago

Please provide as many scripts that reproduce the issue as you can @1-creare-1

There is currently a bug that causes the CPU tracking code to never end in some contexts.

LuaBloxor commented 2 months ago

this will pause execution every time it performs the task.wait

local GetUserId = require('players').GetUserId
for i = 1,10 do
  task.wait(0.1)
  print(pcall(GetUserId,nil,`{math.random()}`))
end
1enu commented 10 hours ago

The throttling 🟡 seems to happen when :Configure is called just as @1-creare-1 said. Based on my observation, it only occurs when:

Repro code below:

local sign = GetPart("Sign")

print("Starting safe test.")
-- These values are confirmed not to exhaust resources
local SAFE_TEST_VALUES = {
    bool = true,
    number = 42,
    table = {},
    vector = Vector3.zero,
    cf = CFrame.new(),
    thread = coroutine.create(function() end),
}

for type, value in SAFE_TEST_VALUES do
    sign:Configure({ SignText = value })
end

-- Direct writes will not exhaust resources
sign.SignText = "Write by key"

-- Strings that aren't valid properties of the part will not exhaust resources
sign:Configure({ ThisPropertyDoesNotExist = "42" })

print("Safe test done. preparing for string test that will exhaust resource.")
-- Wait to make sure the tests above dont interfere
task.wait(1)

-- This will exhaust resources and warn
sign:Configure({ SignText = "42" })

-- Wait so the warn will appear before the print
task.wait()
print("All tests done!")

Logs screenshot:

image