Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sashafiesta opened this issue Mar 27, 2024 · 3 comments
Closed
Labels
area-Core This affects CC's core (the Lua runtime, APIs, computer internals). bug A problem or unexpected behaviour with the mod.

Comments

@sashafiesta
Copy link

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) ~[?:?]
@sashafiesta sashafiesta added the bug A problem or unexpected behaviour with the mod. label Mar 27, 2024
@sashafiesta
Copy link
Author

Sorry for not marking it with area-Core label.

@SquidDev SquidDev added duplicate An issue which has already been reported. area-Core This affects CC's core (the Lua runtime, APIs, computer internals). labels Mar 27, 2024
@SquidDev
Copy link
Member

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

@SquidDev SquidDev closed this as not planned Won't fix, can't repro, duplicate, stale Mar 27, 2024
@SquidDev SquidDev removed the duplicate An issue which has already been reported. label Apr 8, 2024
@SquidDev
Copy link
Member

SquidDev commented Apr 8, 2024

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 :/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Core This affects CC's core (the Lua runtime, APIs, computer internals). bug A problem or unexpected behaviour with the mod.
Projects
None yet
Development

No branches or pull requests

2 participants