CC: Tweaked

CC: Tweaked

57M Downloads

High resources consumption(?) leading to computer malfunction. Again!

sashafiesta opened this issue · 3 comments

commented

Minecraft Version

1.20.x

Version

1.109.6

Details

Here we go again!
I wrote another piece of code that breaks all the computers on server like in #1333

If you run this code on several computers (two are enough), then all other computers on the server will stop responding and executing commands.

e = string.rep("=", 805306366)
c= "return [" .. e.. "[t]" .. e.. "]"
print(#assert(load(c))())

After a while, the computer running code will display the following message:

Error running computer
Too long without yielding
ComputerCraft may be installed incorrectly

Here is the logs:

[03:46:04] [ComputerCraft-Computer-Monitor-0/WARN]: Allocated a negative number of bytes (-3457192592)!
[03:46:43] [ComputerCraft-Computer-Worker-0/ERROR]: Error running task on computer #2
java.lang.InterruptedException: null
	at java.util.concurrent.locks.ReentrantLock$Sync.lockInterruptibly(ReentrantLock.java:159) ~[?:?]
	at java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:372) ~[?:?]
	at dan200.computercraft.core.computer.ComputerExecutor.shutdown(ComputerExecutor.java:425) ~[cc-tweaked-1.20.1-fabric-1.109.6.jar:?]
	at dan200.computercraft.core.computer.ComputerExecutor.resumeMachine(ComputerExecutor.java:565) ~[cc-tweaked-1.20.1-fabric-1.109.6.jar:?]
	at dan200.computercraft.core.computer.ComputerExecutor.workImpl(ComputerExecutor.java:526) ~[cc-tweaked-1.20.1-fabric-1.109.6.jar:?]
	at dan200.computercraft.core.computer.ComputerExecutor.work(ComputerExecutor.java:466) ~[cc-tweaked-1.20.1-fabric-1.109.6.jar:?]
	at dan200.computercraft.core.computer.computerthread.ComputerThread$WorkerThread.runImpl(ComputerThread.java:658) ~[cc-tweaked-1.20.1-fabric-1.109.6.jar:?]
	at dan200.computercraft.core.computer.computerthread.ComputerThread$WorkerThread.run(ComputerThread.java:612) ~[cc-tweaked-1.20.1-fabric-1.109.6.jar:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
commented

Thanks for the report! This is a known issue, just unfortunately a tricky one to solve - see #1580 for more information.

commented

Sorry for not marking it with area-Core label.

commented

Actually, there is a minor change we can make here which should avoid this. Have somewhat fixed this in cc-tweaked/Cobalt@97d2f36. Of course, the underlying issue is you shouldn't be able to allocate gigabyte-long strings, which is a little tricker to fix :/.