The Gold Road Chapter – which includes the Scribing system – and Update 42 is now available to test on the PTS! You can read the latest patch notes here: https://forums.elderscrollsonline.com/en/discussion/656454/

Calling API Functions Many Times Results in String Corruption

Reorx_Holybeard
Reorx_Holybeard
✭✭✭✭✭
Looks like that if you call some API functions many times in a single game frame the returned string is truncated or corrupted. Note that this won't apply to most addons since you need to call functions many 1000s of times within a single frame to start to see this issue. It is a new issue, however, since there have been no issues like this in previous live or PTS versions.

Very simple function to replicate with the GetAbilityDescription() function call:
function TestSkillDesc(abilityId, maxCount)
	maxCount = maxCount or 20000
	abilityId = abilityId or 20328
	
	local firstDesc = GetAbilityDescription(abilityId, 1)
	local desc
	
	d("Testing description of ability "..tostring(abilityId).." with "..tostring(#firstDesc).." characters times...")
	
	for i = 1, maxCount do
		desc = GetAbilityDescription(abilityId, 1)
		
		if (desc ~= firstDesc) then
			d(""..tostring(i)..") Description mismatch")
			d("Orig Desc:"..tostring(firstDesc))
			d("Last Desc:"..tostring(desc))
			return false
		end
	end
	
	return true
end

The code just gets the same ability description over and over until the description changes.
/script TestSkillDesc(20328)
/script TestSkillDesc(20657)
/script TestSkillDesc(32947)

You may need to increase the first number parameter before you see the problem. It seems to be related to the length of the returned string. In my tests the string would get truncated/corrupted at around 2.6 million total characters returned. I'm assuming there's a global string buffer that gets overflowed by calling the function so many times within a single frame. Either the buffer was shortened significantly this PTS patch or changed somehow to introduce this effect.

For now I can work around it by limiting the number of API calls done within a single frame although the dynamic nature of the bug makes it harder to avoid.
Reorx Holybeard -- NA/PC
Founder/Admin of www.uesp.net -- UESP ESO Guilds
Creator of the "Best" ESO Build Editor
I'm on a quest to build the world's toughest USB drive!
  • SirAndy
    SirAndy
    ✭✭✭✭✭
    ✭✭✭✭✭
    Try declaring "desc" as local inside the loop and see if that makes any difference ...
    idea.gif

    for i = 1, maxCount do
        local desc = GetAbilityDescription(abilityId, 1)
        ...
    
  • Feanor
    Feanor
    ✭✭✭✭✭
    ✭✭✭✭✭
    Main characters: Feanor the Believer - AD Altmer mSorc - AR 46 - Flawless Conqueror (PC EU)Idril Arnanor - AD Altmer mSorc - CP 217 - Stormproof (PC NA)Other characters:
    Necrophilius Killgood - DC Imperial NecromancerFearscales - AD Argonian Templar - Stormproof (healer)Draco Imperialis - AD Imperial DK (tank)Cabed Naearamarth - AD Dunmer mDKValirion Willowthorne - AD Bosmer stamBladeTuruna - AD Altmer magBladeKheled Zaram - AD Redguard stamDKKibil Nala - AD Redguard stamSorc - StormproofYavanna Kémentárí - AD Breton magWardenAzog gro-Ghâsh - EP Orc stamWardenVidar Drakenblød - DC Nord mDKMarquis de Peyrac - DC Breton mSorc - StormproofRawlith Khaj'ra - AD Khajiit stamWardenTu'waccah - AD Redguard Stamplar
    All chars 50 @ CP 1700+. Playing and enjoying PvP with RdK mostly on PC EU.
  • Reorx_Holybeard
    Reorx_Holybeard
    ✭✭✭✭✭
    SirAndy wrote: »
    Try declaring "desc" as local inside the loop and see if that makes any difference ...
    idea.gif

    for i = 1, maxCount do
        local desc = GetAbilityDescription(abilityId, 1)
        ...
    

    No effect on the issue. Note that the original issue I found was not saving the description of the same ability but saving the descriptions of all abilities for skill coefficient calculations. This example/replication is just an easier example to show/digest.
    Reorx Holybeard -- NA/PC
    Founder/Admin of www.uesp.net -- UESP ESO Guilds
    Creator of the "Best" ESO Build Editor
    I'm on a quest to build the world's toughest USB drive!
  • SirAndy
    SirAndy
    ✭✭✭✭✭
    ✭✭✭✭✭
    In that case it sounds like a memory issue, maybe the heap is getting corrupted?
    type.gif

  • DoonerSeraph
    DoonerSeraph
    ✭✭✭✭
    OP is nerd sniping us :tongue:

    https://xkcd.com/356/
Sign In or Register to comment.