Jump to content




Serialize Errors With "too Long Without Yielding"


  • You cannot reply to this topic
8 replies to this topic

#1 campicus

  • Members
  • 164 posts

Posted 25 August 2013 - 05:35 AM

As the title says, when I serialize my table (line 77) it can error with "too long without yielding". This doesn't happen often at all, however as it is my mining program it basically runs 24/7. Any ideas why this happens?

For those too lazy to go to pastebin, this is the relevant code:

Spoiler

Pastebin:
http://pastebin.com/CfDr1uNr

#2 campicus

  • Members
  • 164 posts

Posted 25 August 2013 - 07:10 PM

Nobody has any ideas? :s

#3 Imred Gemu

  • Members
  • 47 posts

Posted 25 August 2013 - 10:24 PM

Could you please post the exact error message, I can't tell if it's a bug in your code on in texutils.

#4 jay5476

  • Members
  • 289 posts

Posted 26 August 2013 - 12:24 AM

well first off...
function trackPos()
  position = {xPos, yPos, zPos, facing, long, wide, deep}
  h = fs.open("GPS", "w")
  h.write(textutils.serialize(position))
  h.close()
end
xPos etc. are declared outside of the function i dont know if that will cause it to error but it would be safer to do
function trackPos(xPos, yPos, zPos, facing, long, wide, deep)
  position = {xPos, yPos, zPos, facing, long, wide, deep}
  h = fs.open("GPS", "w")
  h.write(textutils.serialize(position))
  h.close()
end
trackPos() -- with relitive terms eg. trackPos(1,2,3,"north",5,8,10)
see if that makes a difference

#5 Bubba

    Use Code Tags!

  • Moderators
  • 1,142 posts
  • LocationRHIT

Posted 27 August 2013 - 09:35 AM

This is a too long without yielding error. You would not experience that error because of missing variables, jay.

@OP Try addding in something like this before and/or after a call to trackPos:
os.queueEvent("trash_event")
coroutine.yield()


#6 McLeopold

  • Members
  • 123 posts

Posted 27 August 2013 - 10:23 AM

Can you pastebin the contents of you GPS file when it times out again?

#7 campicus

  • Members
  • 164 posts

Posted 27 August 2013 - 08:46 PM

View PostMcLeopold, on 27 August 2013 - 10:23 AM, said:

Can you pastebin the contents of you GPS file when it times out again?

The GPS file was empty, nothing in it at all but it did exist.

View PostImred Gemu, on 25 August 2013 - 10:24 PM, said:

Could you please post the exact error message, I can't tell if it's a bug in your code on in texutils.

The funny thing is I got an error msg relating to my code on one turtle, and an error message relating to textutils on another turtle. Both were "too long without yielding".

My turtles haven't done this again since I changed my code to this:

function trackPos()
  position = {xPos, yPos, zPos, facing, long, wide, deep}
  h = fs.open("GPS", "w")
  h.write(textutils.serialize(position))
  sleep(0.1)
  h.close()
end

If it happens again I will record the exact error before breaking the turtle (duh) and report back. Will also try everyone's suggestions. Thanks to everyone that responded :)

#8 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 28 August 2013 - 03:40 AM

It's almost certainly a bug in your code. It just happened to be inside serialize when the timer ran out. Post your full code.

#9 Bubba

    Use Code Tags!

  • Moderators
  • 1,142 posts
  • LocationRHIT

Posted 28 August 2013 - 06:42 AM

View Postimmibis, on 28 August 2013 - 03:40 AM, said:

It's almost certainly a bug in your code. It just happened to be inside serialize when the timer ran out. Post your full code.

The OP did post his full code. See his first post again.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users