Jump to content




Bug in wireless modems


24 replies to this topic

#1 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 17 April 2012 - 02:17 PM

Please see this post:

http://www.computerc...ndpost__p__9692

This 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.

#2 Wolvan

  • New Members
  • 384 posts
  • LocationIn the TARDIS

Posted 17 April 2012 - 02: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

#3 theubie

  • New Members
  • 9 posts

Posted 17 April 2012 - 03: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.

#4 cant_delete_account

  • Members
  • 484 posts

Posted 17 April 2012 - 05:37 PM

View Posttheubie, on 17 April 2012 - 03:16 PM, said:

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.

#5 cant_delete_account

  • Members
  • 484 posts

Posted 17 April 2012 - 05: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.

#6 Wolvan

  • New Members
  • 384 posts
  • LocationIn the TARDIS

Posted 17 April 2012 - 05: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

#7 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 17 April 2012 - 06: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?

#8 Wolvan

  • New Members
  • 384 posts
  • LocationIn the TARDIS

Posted 17 April 2012 - 06: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

#9 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 18 April 2012 - 02: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.

#10 Wolvan

  • New Members
  • 384 posts
  • LocationIn the TARDIS

Posted 18 April 2012 - 12: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)

#11 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 18 April 2012 - 01: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.

#12 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 18 April 2012 - 11:48 PM

View PostWolvan, on 17 April 2012 - 02:38 PM, said:

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


#13 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 19 April 2012 - 12: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.

#14 Wolvan

  • New Members
  • 384 posts
  • LocationIn the TARDIS

Posted 19 April 2012 - 04:07 PM

View PostCloudy, on 19 April 2012 - 12:07 AM, said:

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

#15 LazerRay

  • New Members
  • 18 posts

Posted 19 April 2012 - 09: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.

#16 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 19 April 2012 - 09: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 by luanub, 19 April 2012 - 09:56 PM.


#17 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 19 April 2012 - 11:56 PM

View Postluanub, on 19 April 2012 - 09:46 PM, said:

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.

#18 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 20 April 2012 - 12: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 by luanub, 20 April 2012 - 08:37 AM.


#19 Wolvan

  • New Members
  • 384 posts
  • LocationIn the TARDIS

Posted 20 April 2012 - 11:04 AM

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

#20 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 20 April 2012 - 12: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?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users