Jump to content




Too Long Without Yielding On Previously Working Code

turtle computer

7 replies to this topic

#1 TheModerGuy

  • Members
  • 16 posts
  • LocationAustralia, NOT Austria!!!

Posted 30 August 2013 - 10:41 PM

I'm not sure if its a bug with computer craft or my code but all of the computers on my servers using while true loops keep getting "too long without yielding"

my situation:
version : 1.5.2
Computercraft version : 1.53
what i think the error: probably something to do with the tps
other mods : FTB Unleashed 1.5.2

OK so i had code on my pastebin from 1.4.7 here is the code:

term.clear()
term.setCursorPos(1,1)
os.setComputerLabel("TMG"..os.getComputerID())
print("Killing Mobs...")

while true do
	  for i=1,3 do
		   turtle.select(i)
		   turtle.drop()
	  end
	  turtle.attack()
	  sleep(0)
end

after a few hours it stops and spits out too long without yielding, I've done everything i can think of to fix it but no go.
i get the same error on another computer too and its not even a turtle:

too big to paste here so: http://pastebin.com/QRDqnUJM

Attached Thumbnails

  • Attached Image: too long.png


#2 bigbaddevil6

  • Members
  • 72 posts

Posted 30 August 2013 - 11:30 PM

i had that problem in 1.4.7 with the DW20 pack it had to do with miscperipherals had a problem i haven't played on the unleashed pack so im not sure if there any conflicts or not. in current releases of the mods it seems to be working fine. If it is the code im sure a smarter mind than mine will figure it out.

#3 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

Posted 30 August 2013 - 11:52 PM

If your computer is too slow or you have too many CC computers running or some bastard is using exploits to screw you then this will happen. Unfortunately there is nothing you can do about the latter

#4 BigTwisty

  • Members
  • 106 posts

Posted 31 August 2013 - 02:04 AM

I've always found that if you increase the os.sleep time this particular problem tends to go away.

#5 CCJJSax

  • Members
  • 262 posts

Posted 31 August 2013 - 02:40 AM

I find that sleep(0) is pretty pointless ;) I would up that time and things should work fine

#6 floppyjack

  • Members
  • 18 posts

Posted 31 August 2013 - 07:12 AM

View PostCCJJSax, on 31 August 2013 - 02:40 AM, said:

I find that sleep(0) is pretty pointless ;) I would up that time and things should work fine

I just did some research & testing and it turns out that the sleep function calls coroutine.yield, so increasing the time should not make any difference.

#7 CCJJSax

  • Members
  • 262 posts

Posted 31 August 2013 - 02:36 PM

Perhaps you could have some reboot thing. After so many times of it going through, maybe it should get a good reboot. I know this is a little out there, but I think it's worth a shot.

#8 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

Posted 01 September 2013 - 12:16 PM

rebooting doesn't really solve the issue hey. In reality all of the turtle actions yield too so that sleep is entirely unnecessary. If you are the server owner run a search through the CC files for "coroutine" and "parallel". If someone has something that created a new thread every time it is used or has a coroutine that pretty much just yields then toss him out/delete that prog and it just might sort out your issue. It will improve the speed of your computers for sure





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users