+ Reply to Thread
Results 1 to 10 of 10
Like Tree1Likes
  • 1 Post By ZorbaTHut

  Click here to go to the first Rift Team post in this thread.   Thread: Error, free up some space => while batch posting

  1. #1
    Rift Disciple
    Join Date
    Mar 2011
    Posts
    130

    Default Error, free up some space => while batch posting

    I made a proof of concept add-on that batch posts items to the AH.

    It essentially loops through my bags and post reach items it finds. I make sure that the global queue is available before trying to post and yet I keep getting errors about my inventory and "lacking space". When this happens, the loop breaks and I need to start posting again. Sometimes it fails after the first item, sometimes after a couple. So far the best shot I got was ~18 items before getting the error.

    Problem is there is plenty of space in my bags. I've made this small video where you can see the error happening.

    https://www.youtube.com/watch?v=CI_Z...w6aMbn-WHuxzpl

    I don't thing that the issue is coming from my code, as I have a very similar behavior when trying to fetch emails attachments from the mailbox.

    Thanks for your help !

    pseudocode:

    Code:
     loops through_the_bags 
     current_item =  Utility.Item.Slot.Inventory(bag,slot)
     if queue_is_not_buzy then
    	-- posting the item
    	local value = Inspect.Item.Detail(current_item)["sell"]
    	Command.Auction.Post(item_id, 12, value, value)
       end
    end

  2.   Click here to go to the next Rift Team post in this thread.   #2
    Rift Team
    Join Date
    Oct 2010
    Posts
    927

    Default

    Looks like this is one of those race condition glitches that occurs on live servers but not dev servers. The best suggestion I can make is to either add some delay between posts or make the code smart enough to retry if an item wasn't posted properly. I've got plans for a better solution, but it's complex enough that it will probably have to wait for 1.8.

    This shouldn't be an API-breaking issue, just an irritation, but we'll get it fixed once we can.

    (Thanks for the video, by the way, that helped )
    Last edited by ZorbaTHut; 02-01-2012 at 09:19 AM.

  3. #3
    Rift Disciple
    Join Date
    Mar 2011
    Posts
    130

    Default

    Quote Originally Posted by ZorbaTHut View Post
    Looks like this is one of those race condition glitches that occurs on live servers but not dev servers. The best suggestion I can make is to either add some delay between posts or make the code smart enough to retry if an item wasn't posted properly. I've got plans for a better solution, but it's complex enough that it will probably have to wait for 1.8.

    This shouldn't be an API-breaking issue, just an irritation, but we'll get it fixed once we can.

    (Thanks for the video, by the way, that helped )
    By live server, do you mean, the PTS ? If you want to test my add-on on a dev machine, let me know we'll work something out.

    How would I add a delay without resorting to a busy-wait loop (which coincidentally crashes the client) ? I might have overlooked something. Lua doesn't offer out of the box sleep commands which I would have throttled to something close to 3 seconds between each post.

    Problem isn't with retrying, the problem is that the loop breaks when the error occur.

    I can definitely wait for 1.8, its easy to restart the batch process by clicking the batch post button.

    I simply LOVE that video feature. Its a QA's dream, ok I'm exaggerating. But it definitely helps in explaining an issue to a dev.

  4.   This is the last Rift Team post in this thread.   #4
    Rift Team
    Join Date
    Oct 2010
    Posts
    927

    Default

    Quote Originally Posted by Frostshizzle View Post
    By live server, do you mean, the PTS ? If you want to test my add-on on a dev machine, let me know we'll work something out.
    I mean servers that are open to connections from the outside

    Quote Originally Posted by Frostshizzle View Post
    How would I add a delay without resorting to a busy-wait loop (which coincidentally crashes the client) ? I might have overlooked something. Lua doesn't offer out of the box sleep commands which I would have throttled to something close to 3 seconds between each post.
    Hook Event.System.Update.End and check each frame whether it's time to wake up. There might be a more generalized library available to make this cleaner, or there might not be.

    Quote Originally Posted by Frostshizzle View Post
    Problem isn't with retrying, the problem is that the loop breaks when the error occur.
    I'm going to guess that the loop doesn't actually break, it's just that every command afterwards is ignored. Add a print() statement inside the loop to verify this. Keep in mind that you'll never get a server response before returning from the Lua environment - all of those auction messages are sent out before any response could possibly arrive.

  5. #5
    RIFT Community Ambassador the_real_seebs's Avatar
    Join Date
    Jan 2011
    Posts
    16,859

    Default

    If people want a "wake me in N seconds" type library, I could make one super easily.
    You can play WoW in any MMO. You don't have to play WoW in RIFT. Oh, and no, RIFT is not a WoW clone. Not having fun any more? Learn to play, noob! I don't speak for Riftui, but I moderate stuff there. Just came back? Welcome back! Here's what's changed. (Updated for 2.5!)

  6. #6
    Rift Disciple
    Join Date
    Mar 2011
    Posts
    130

    Default

    Quote Originally Posted by ZorbaTHut View Post
    I mean servers that are open to connections from the outside
    ok, so those errors did occurred on the PTS. In any case, if you want to see if that race condition can be reproduced on a dev machine I can send you my add-on.


    Quote Originally Posted by ZorbaTHut View Post
    Hook Event.System.Update.End and check each frame whether it's time to wake up. There might be a more generalized library available to make this cleaner, or there might not be.
    I'll look this up. Thanks !


    Quote Originally Posted by ZorbaTHut View Post
    I'm going to guess that the loop doesn't actually break, it's just that every command afterwards is ignored. Add a print() statement inside the loop to verify this. Keep in mind that you'll never get a server response before returning from the Lua environment - all of those auction messages are sent out before any response could possibly arrive.
    I've added some debugging output. I'll retest after my auctions expired in 12h. (well most likely tomorrow)

    A big thanks for your help. I'm having as much fun coding this add-on as playing the game itself

  7. #7
    Rift Disciple
    Join Date
    Mar 2011
    Posts
    130

    Default

    Quote Originally Posted by the_real_seebs View Post
    If people want a "wake me in N seconds" type library, I could make one super easily.
    I'm definitely interested!

  8. #8
    Rift Disciple
    Join Date
    Mar 2011
    Posts
    130

    Default

    I tried making my own "sleep" thread.

    here is the code I used :

    Code:
    function sleep(sleep_time)
    	sleep_start_time = os.time()
    	sleep_end_time = sleep_time
    	is_sleeping_now = true
    end
    
    function isSleeping()
    	if sleep_start_time ~= nil then
    		is_sleeping_now = false
    		time_spent_sleeping = os.difftime(os.time(), sleep_start_time)
    		if time_spent_sleeping <= sleep_end_time then
    			is_sleeping_now = true
    			print("sleeping !")
    		else if time_spent_sleeping > sleep_end_time then
    				sleep_start_time = nil
    			end
    		end
    	end
    end
    
    local queueStatus = false
    local function QueueStatus()
    	queueStatus = Inspect.Queue.Status("global")
    	if queueStatus then return end -- global queue is still backlogged, var is true so exit out
    	queueStatus = false
    end
    
    local function mailOpen(k)
    	if not QueueStatus() and not is_sleeping_now then
    		Command.Mail.Open(k)
    		sleep(1)
    	else
    		mailOpen(k)
    	end
    end
    
    table.insert(Event.System.Update.Begin, {isSleeping, "myAddon", "SleepStatus"})
    The sleep function is called, the Event.System.Update fires up, calling my isSleeping method, which should detect if i'm done sleeping or not.

    Unfortunately, it doesn't as I'm getting a stack overflow error

    Here is the video of the results :
    http://youtu.be/WW86sxT3VVE

    I must admit the video is short and you don't see much happening, but it happens pretty much as soon as I try to process my mailbox.
    Last edited by Frostshizzle; 02-01-2012 at 06:29 PM.

  9. #9
    Champion Lorandii's Avatar
    Join Date
    Jun 2011
    Posts
    516

    Default

    Quote Originally Posted by Frostshizzle View Post
    Unfortunately, it doesn't as I'm getting a stack overflow error
    No localized variables; you aren't returning anything from your sleep() function; is_sleeping_now is not pre-defined and doesn't exist, true or false. You are on the right track, however.

  10. #10
    Rift Disciple
    Join Date
    Mar 2011
    Posts
    130

    Default

    Quote Originally Posted by Lorandii View Post
    No localized variables; you aren't returning anything from your sleep() function; is_sleeping_now is not pre-defined and doesn't exist, true or false. You are on the right track, however.
    I removed the "local" part of the function, for some reason it would throw out an error if I did.

    I'll edit the post above reflecting what I do now.

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts