Not signed in (Sign In)
    •  
      CommentAuthorbrykrys
    • CommentTimeOct 7th 2008
     
    I noticed this in the OnEvent() handler of CoreMain.lua (line 185 in version 5.0.0):


    elseif (event == "PLAYER_LOGOUT") then
    AucAdvanced.Scan.Commit(true)
    private.OnUnload()
    AucAdvanced.Scan.LogoutCommit()


    The OnUnload calls the OnUnload() functions for all loaded modules;

    Auc-ScanData's OnUnload() packs the scan image into a string (ScanData.lua line 326+);

    AucAdvanced.Scan.LogoutCommit() forces any suspended Commit coroutine to run until completion, but ---

    The coroutine function expects the scan image to still be a table! (e.g CoreScan.lua line 652 attempts to call table.insert() on the string).


    I'm not sure that this can actually corrupt the scan data string (I think it would just throw a lua error and then stop), but any uncommited scan data will be lost.

    Looks like the OnUnload() call should go last.
    • CommentAuthorRockSlice
    • CommentTimeOct 7th 2008
     
    You're right, it should. TY
    •  
      CommentAuthordinesh
    • CommentTimeOct 7th 2008
     
    might this be what's causing all those intermittent scandata corruptions?
    • CommentAuthorRockSlice
    • CommentTimeOct 7th 2008
     
    It's quite possible (even probable) that it's causing scandata corruption.

    However, I'm hesitant to say that it's causing "all" of them. It has been fixed in trunk, so we'll see if the rate of scandata corruption goes down at all with 5.0.1
    •  
      CommentAuthorbrykrys
    • CommentTimeOct 7th 2008
     
    I was hunting for a possible cause of http://jira.norganna.org/browse/ADV-111

    However I don't see how this could cause the corruption in the sample file provided by jlva321 :(

    At worst, I think this would cause Auc-ScanData to try to save an incomplete scan image - but looking at the packing code, I think it should then generate a 'valid' string which just unpacks into an incomplete table again. Instead, the string itself is somehow getting corrupted, so that it fails to unpack at load time. I would expect that calling table.insert or table.remove on a string should not actually modify the string.

    We shall see though :)
    • CommentAuthorRockSlice
    • CommentTimeOct 7th 2008
     
    ADV-111's sample code could have been caused by one of quite a few problems we've fixed since then.

    The latest corrupted data I looked at had a nil entry for an auction, which this bug could have caused.
    •  
      CommentAuthorbrykrys
    • CommentTimeOct 7th 2008
     
    kk, lets see what this fixes :)

    A suggestion though - currently if Auc-ScanData fails to load the image string, it simply prints a message to 'chat'

    I suspect that most users won't notice this message, because they will immedialty get another error message popping up in their face, when AA trys to use the bad data.

    Maybe this should be 'promoted' to an Error message, so that it is more likely to be reported correctly?
    • CommentAuthorRockSlice
    • CommentTimeOct 7th 2008
     
    If Auc-Scandata fails to load the image string, there's no scandata there to be used (or be corrupted), so this wouldn't help.
    •  
      CommentAuthorbrykrys
    • CommentTimeOct 8th 2008
     
    Hmm, look at what happens to fData.image in this snippet from ScanData.lua (line 310+)

    if fData.image and type(fData.image) == "string" then
    local loader, err = loadstring(fData.image)
    if (loader) then
    fData.image = loader()
    collectgarbage()
    else
    print("Error loading scan image: {{", err, "}}")
    end


    Initially fData.image is a string (the packed image)

    If loadstring succeeds then fData.image is replaced with a table (the return value from the loader() call)

    If loadstring fails then fData.image is unchanged - i.e. it's still a string

    This will almost immediatly throw a lua error elsewhere, when another function expects the image to be a table -

    Note in CoreScan.lua line 500:

    for i = 1, #scandata.image do
    id = scandata.image[i][Const.ID]
    table.insert(idList, id)


    scandata.image is (still) a string
    #scandata.image returns the length of the string
    scandata.image[i] returns nil (does not throw an error like I expected!)
    scandata.image[i][Const.ID] then reports that you're trying to index a nil value
    • CommentAuthorRockSlice
    • CommentTimeOct 8th 2008 edited
     
    another nice catch! TY
    •  
      CommentAuthorbrykrys
    • CommentTimeOct 8th 2008
     
    • CommentAuthorRockSlice
    • CommentTimeOct 8th 2008
     
    and... fixed for next release :)
World of Warcraft™ and Blizzard Entertainment™ are trademarks or registered trademarks of Blizzard Entertainment, Inc. in the U.S. and/or other countries.