2447 posts
Posted 17 April 2012 - 03:17 PM
Please see this post:
http://www.computercraft.info/forums2/index.php?/topic/1082-project-net-block/page__view__findpost__p__9692This code:
while true do
sleep(0)
rednet.broadcast("SPAM")
--or
rednet.send(PCID, "KILL")
end
Will cause a java error (in the computer console) if they are waiting for rednet events.
I haven't actually tested this myself so can't be more specific - but it is obviously a bug.
378 posts
Location
In the TARDIS
Posted 17 April 2012 - 03:38 PM
Steps to reproduce:
1. set up an infinite loop like this
while true do
id, text = rednet.receive()
end
2. set up a computer that attacks like this
while true do
sleep(0) --To prevent too long without yielding
rednet.broadcast("SOME STUFF. DOESN'T REALLY MATTER")
end
3. Crash the receiving program of the other PC with this
9 posts
Posted 17 April 2012 - 04:16 PM
Hm. Guess I never have seen this since I use os.pullEvent and check for rednet_message rather than use rednet.receive. I've got a very chatty array of computers running my whole outfit with no problems.
474 posts
Posted 17 April 2012 - 06:37 PM
Hm. Guess I never have seen this since I use os.pullEvent and check for rednet_message rather than use rednet.receive. I've got a very chatty array of computers running my whole outfit with no problems.
Yeah, I prefer filtering for rednet messages through events too.
474 posts
Posted 17 April 2012 - 06:41 PM
If you didn't want some jerks crashing everyone's computer that is receiving rednet messages, I guess you could just edit the /lua/rom/apis/rednet and make it so it checks how much messages are being sent. Temporary fix, I guess.
378 posts
Location
In the TARDIS
Posted 17 April 2012 - 06:45 PM
Don't know if it crashes os.pullEvent() too. I think leo verto used rednet.receive but I'm not sure. Could be os.pullEvent too
1604 posts
Posted 17 April 2012 - 07:01 PM
Was it on SMP? cause I had two computers doing that for like 15 minutes and nothing happened, or it takes longer to happen?
378 posts
Location
In the TARDIS
Posted 17 April 2012 - 07:35 PM
Nope was SMP and the thing was done in maybe 1-2min. I don't now when it stopped that was the time when I looked at it
1111 posts
Location
Portland OR
Posted 18 April 2012 - 03:11 AM
So this is very similar to an ICMP attack or something like that in real life. You hammer something hard enough it breaks. Not necessarily a bug.
Try pinging a real computer over and over that fast and see what happens.
378 posts
Location
In the TARDIS
Posted 18 April 2012 - 01:40 PM
True lua and I think that way too. But I think that this is not supposed to happen in CC so it's counted as bug (for some guys like cloudy)
2447 posts
Posted 18 April 2012 - 02:10 PM
Yes, but this is Minecraft and people like griefing :)/>/>
I'll check it out later and see if I can reproduce it to get more information.
718 posts
Location
Hawaii
Posted 19 April 2012 - 12:48 AM
Steps to reproduce:
1. set up an infinite loop like this
while true do
id, text = rednet.receive()
end
2. set up a computer that attacks like this
while true do
sleep(0) --To prevent too long without yielding
rednet.broadcast("SOME STUFF. DOESN'T REALLY MATTER")
end
3. Crash the receiving program of the other PC with this
I think I know how to solve this.
You need to add a sleep to receive because it will keep receiving and not stop. It's kinda like holding enter on here:
while true do
test = read()
end
2447 posts
Posted 19 April 2012 - 01:07 AM
No, that isn't the issue at all. It should be able to receive many in a row - adding a sleep would potentially miss data.
378 posts
Location
In the TARDIS
Posted 19 April 2012 - 05:07 PM
No, that isn't the issue at all. It should be able to receive many in a row - adding a sleep would potentially miss data.
Yep we want to receive a message from different computers. Now everything gets flooded and we miss real data
18 posts
Posted 19 April 2012 - 10:46 PM
The only way to kill a DoS attack is to kill the connection and reset, no other way around it, this is true for real computers too.
1111 posts
Location
Portland OR
Posted 19 April 2012 - 10:46 PM
Do you do anything with the data you receive? That's going to take time and add the risk of missing a message anyway. Have you tried running coroutines or parallel functions to resolve the problem?
You can also try similar to what is being talked about in this post
http://www.computerc...for-broadcasts/Using a loop with nothing but a receive in it isn't very practical.. :)/>/> It probably doesn't happen much if at all, unless someone is trying to force something like this to happen.
This is why I still think this is no bug and is just something your code is going to have to be smart enough to handle(if they aren't already) if your playing on a server where these types of attacks may take place.
I have tried sending these attacks to my receiving programs and they all handle it just fine. I have not taken any steps in any of my programs to stop any attacks since I mainly play with close friends or in SSP.
Just incase it's the fact that I'm running allot of memory in my computer I figured I would go a little further. I have 4 different real programs running that all sit waiting for rednet messages. One of which generates a list of names with the messages it receives. I have been sending the attack for nearly 10 mins so far and nothing. Seems pretty robust to me, none of these programs are setup to avoid an attack such as this. i have a really long list of the word "STUFF".
Edited on 19 April 2012 - 08:56 PM
2447 posts
Posted 20 April 2012 - 12:56 AM
Do you do anything with the data you receive? That's going to take time and add the risk of missing a message anyway
That is incorrect. The message will be stored as an event, ready to be retrieved the next time the receive function gets called, providing you don't use any functions such as sleep() - which eats any events until the sleep is done.
1111 posts
Location
Portland OR
Posted 20 April 2012 - 01:35 AM
So if understand what your saying right the two first script would take no more time then the second and would not have any risk of missing a message? And I could still utilize the messages that were received in the second script somehow? If so that could be handy. How would you go about doing it?
while true do
id, msg = rednet.receive()
file = io.open("list.txt", "a")
file:write(msg.."n")
file:close()
end
while true do
id, msg = rednet.receive()
end
So far the first one has been running for almost 3 hours getting hammered with the attack and its still running fine. Memory usage == normal and cpu usage == normal.
So I ran the attack for well over 8 hours while I was at work. Came home and everything was running fine. CPU usage stayed at a normal 15%, the memory usage had increased quite a bit from 15% to around 45%. Not allot on my system but on a weaker system(something with < 4gb ram) it probably would have crashed. Keep in mind I was attacking 4 computers for over 8 hours to get it to that point.
Edited on 20 April 2012 - 07:37 AM
378 posts
Location
In the TARDIS
Posted 20 April 2012 - 12:04 PM
Our System waits for an specific message and if it receives it it will send data to another PC. It also prinst every received message as a log on the screen
2447 posts
Posted 20 April 2012 - 01:35 PM
Is there any chance you can post the full code so that we can test it ourselves and see if there's any issues?
378 posts
Location
In the TARDIS
Posted 20 April 2012 - 03:37 PM
Sry you have to ask Leo Verto if he can post it here. He is the server host
2447 posts
Posted 30 May 2012 - 05:22 PM
Can anyone reproduce this and post code to do it? I have tried in my dev environment and can't seem to reproduce it.
514 posts
Location
Over there
Posted 30 May 2012 - 05:42 PM
Hmm, somehow, I didn't really notice this happened on my server. :)/>/>
Of course I can give you the code, but I would need the computer ID, because I can#t search through hundreds of computer folders.
@Wolvan just tell me on hamachi when you have for joining the server.
686 posts
Posted 31 May 2012 - 08:38 AM
So this is very similar to an ICMP attack or something like that in real life. You hammer something hard enough it breaks. Not necessarily a bug.
Try pinging a real computer over and over that fast and see what happens.
It should be able to handle it without issue, you wouldn't be able to send pings from a single computer faster than another computer can handle them. More likely, the router (or modem, like ComputerCraft) or NIC will handle it all without even getting to the OS.
1111 posts
Location
Portland OR
Posted 31 May 2012 - 11:13 AM
So this is very similar to an ICMP attack or something like that in real life. You hammer something hard enough it breaks. Not necessarily a bug.
Try pinging a real computer over and over that fast and see what happens.
It should be able to handle it without issue, you wouldn't be able to send pings from a single computer faster than another computer can handle them. More likely, the router (or modem, like ComputerCraft) or NIC will handle it all without even getting to the OS.
Thats why you normally use multiple computers in those types of attacks, sometimes hundreds depending on what your hitting. :)/>/>
Even with using multiple computers in CC however I was unable to duplciate this bug.