477 posts
Location
Germany
Posted 13 February 2015 - 07:02 PM
This isn't a bug, but should be fixed anyway!
If you have these to files on one computer:
start:
while true do
shell.run("prog2")
sleep(0)
end
prog2:
while true do
print("blablabla")
end
and execute "start", all Computers in the world will freeze/work very slowly. I used the benchmark tool by 1lann(
Ef4SdA3k) and got this results:
without running:
Text Rendering: 7.0
Color Rendering: 20.1
Advanced Rendering: 13.0
Computing Power: 3.8
The lower the number, the better
---------------------------
Total (Out of 50): 11.1
The higher the better for the total
with running:
Text Rendering: 57.05
Color Rendering: 75.4
Advanced Rendering: 62.1
Computing Power: 51.25
The lower the number, the better
---------------------------
Total (Out of 50): -190.8
The higher the better for the total
Hope this get fixed, because it would be very annoying if someone runs this ins SMP.
3057 posts
Location
United States of America
Posted 13 February 2015 - 07:12 PM
There really isn't any way to fix this, I know what's happening though.
start runs prog2, prog2 runs until it's killed, then start runs prog2 immediately after that.
570 posts
Posted 13 February 2015 - 07:28 PM
Well, this is why the "too long without yielding" error exists but I suppose you've just found a workaround. I guess the simplest fix would be to reduce the time a program can run for without yielding.
3057 posts
Location
United States of America
Posted 13 February 2015 - 07:46 PM
Well, this is why the "too long without yielding" error exists but I suppose you've just found a workaround. I guess the simplest fix would be to reduce the time a program can run for without yielding.
That wouldn't fix this.
Really, what we need is shell.run to crash the program that's using shell.run if the program errored with "too long without yielding"
8543 posts
Posted 13 February 2015 - 07:59 PM
This isn't really a bug, it's an abuse of the event system and the way ComputerCraft handles the yield protection. In my opinion, it is already handled the correct way, by killing the offending coroutine only, as that allows multi-tasking to only destroy problematic programs' coroutines, rather than dropping the entire computer.
477 posts
Location
Germany
Posted 14 February 2015 - 08:34 AM
As I wrote, it isnt really a bug, but it should be fixed(In my opinion), because you could stop all computers on a server by using this. Hope noone will do it, but idk if yomeone would use this really on a server.
148 posts
Posted 14 February 2015 - 10:02 AM
There really isn't any way to fix this, I know what's happening though.
You could limit the thread usage for each computer therefor creating an error if the computer exceeds the thread usage
8543 posts
Posted 14 February 2015 - 08:50 PM
That sounds vaguely like the yield protection time limits that are already in place.
148 posts
Posted 15 February 2015 - 09:58 AM
That sounds vaguely like the yield protection time limits that are already in place.
Looks like they don't do a good job currently
7083 posts
Location
Tasmania (AU)
Posted 15 February 2015 - 10:51 AM
One could argue that forcing the systems to shut down whether or not it's possible to just kill the scripts would indeed solve this. The downside to that is that uniformed users triggering yield protection by accident would no longer get a helpful error to look up.
Call me naive, but are people really running this sort of malicious code on purpose? I'd like to imagine that ComputerCraft is typically only used on servers which utilise whitelists and so on. This sort of griefing is piecemeal compared to what can be done with the mod.