HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Ouch

07-24-2006, 07:54 PM#1
Vexorian
Collapse 1st:
function hhh takes nothing returns nothing
 local string k="a" //I2S(GetRandomInt(0,10000))
 local integer n=GetRandomInt(1,1000)

    call StoreInteger(udg_gamacache,k,"a",n)
    call StoreInteger(udg_gamacache,k,"ab",n-1)

    if((GetStoredInteger(udg_gamacache,k,"a")!=n)or (GetStoredInteger(udg_gamacache,k,"ab")!=n-1) ) then
        if( gg_unit_hpea_0001!=null) then
            call KillUnit(gg_unit_hpea_0001)
            set gg_unit_hpea_0001=null
            call BJDebugMsg("|cffff3333Ouch!|cffffff00 Holy cow gamecache bug

wanted : "+I2S(n)+" , "+I2S(n-1)+"
got    : "+I2S(GetStoredInteger(udg_gamacache,k,"a"))+" , "+I2S(GetStoredInteger(udg_gamacache,k,"ab")))
        endif
        call DestroyTimer(GetExpiredTimer())
    else
        call SetWidgetLife(gg_unit_hpea_0001,n)
    endif
endfunction

//===========================================================================
function InitTrig_Melee_Initialization takes nothing returns nothing
 local integer stress=100000
    set gg_trg_Melee_Initialization = CreateTrigger(  )
    loop
        exitwhen stress==0
        call TimerStart(CreateTimer(),GetRandomReal(2.,3.),true,function hhh)
        set stress=stress-1
    endloop
    set udg_gamacache=InitGameCache("anakonda.w3g")
endfunction

Collapse 2nd:
function hhh takes nothing returns nothing
 local string k="a" //I2S(GetRandomInt(0,10000))
 local integer n=GetRandomInt(1,1000)

    if (udg_gamacache==null) then
        call BJDebugMsg("???")
        set udg_gamacache=InitGameCache("anakonda.w3g")
    endif

    call StoreInteger(udg_gamacache,k,"a",n)
    call StoreInteger(udg_gamacache,k,"ab",n-1)

    if((GetStoredInteger(udg_gamacache,k,"a")!=n)or (GetStoredInteger(udg_gamacache,k,"ab")!=n-1) ) then
        if( gg_unit_hpea_0001!=null) then
            call KillUnit(gg_unit_hpea_0001)
            set gg_unit_hpea_0001=null
            call BJDebugMsg("|cffff3333Ouch!|cffffff00 Holy cow gamecache bug

wanted : "+I2S(n)+" , "+I2S(n-1)+"
got    : "+I2S(GetStoredInteger(udg_gamacache,k,"a"))+" , "+I2S(GetStoredInteger(udg_gamacache,k,"ab")))
        endif
        call DestroyTimer(GetExpiredTimer())
    else
        call SetWidgetLife(gg_unit_hpea_0001,n)
    endif
endfunction

//===========================================================================
function InitTrig_Melee_Initialization takes nothing returns nothing
 local integer stress=100000
    set gg_trg_Melee_Initialization = CreateTrigger(  )
    loop
        exitwhen stress==0
        call TimerStart(CreateTimer(),GetRandomReal(2.,3.),true,function hhh)
        set stress=stress-1
    endloop
    set udg_gamacache=InitGameCache("anakonda.w3g")
endfunction

Explanation
If there is a problem with gamecache (the stored value is not the same to the expected one) it would kill a peasant and show an error message.

Test 1: after 3~ seconds it kills the peasant.

Test 2: after 3~ seconds it shows ??? and nothing else happens.

Many guys should have been experiencing random issues with gamecache if used extensivelly, it is because the optimizer changed the usage of gamecache functions into variables and added the initializer to the beginning of the map.

We thought this would make everything faster and better

But this glitch has kicked our ass, instead of making things better it causes a lot of issues.

Edit: false alarm (look bellow)
07-24-2006, 07:56 PM#2
Rising_Dusk
Vex, I would like to personally thank you for testing this.
I am thoroughly glad that I was not insane when I said that Game cache didn't work and wasn't reliable.

You have no idea how thankful I am that you did this.
I'm also glad you've come to a conclusion of what might be causing the problem.
I hope this solves the problem for all of our sakes.
07-24-2006, 07:58 PM#3
Vexorian
I think that it we keep looking for we will find a wc3 bug that causes all the units in the map to convert into sheep.
07-24-2006, 08:01 PM#4
iNfraNe
Interesting. Now I think I believe it.

However, does this mean the
Collapse JASS:
function GC takes nothing returns gamecache
  if udg_Cache == null then
    call FlushGameCache(InitGameCache("Jass.w3v"))
    set udg_Cache=InitGameCache("Jass.w3v")
  endif
 return udg_Cache
endfunction
function will also fix it, or will all stored values leak from the cache once the variable becomes null?

Also, does this always happen, or only with timers (I dont see the reason why you used timers in the test?)
07-24-2006, 08:04 PM#5
Vexorian
It seems to be caused by stress ful situations.

And yes that will cause issues too that's the reason we have to update a lot of systems.


I used timers because they simulate the situations that the guys were pointing out.

I am gonna give 50 rep to whoever explains in what exact situations gamecache variables become null
07-24-2006, 08:06 PM#6
iNfraNe
Gonna give yourself even more rep? ^^
07-24-2006, 08:06 PM#7
Rising_Dusk
Inf, about the other topic, I didnt want to discuss it there so that it wouldn't degenerate into a pissing contest where people are just trying to be correct over everyone else.

I didn't have proof, nor was I qualified to find any.
And now that Vex has found some, it's all ok again.
I knew something was wrong, because I would test hundreds of times in my map and find problems that made no sense and had no rhyme nor reason to them.

This "Turn To Null" bug as I henceforth shall call it would explain it all, since 100% of the triggers end when groups turn up empty or some such, causing premature termination of the spell and such.
If we can positively remove this problem from our systems, then I imagine Game Cache will be significantly safer and more reliable to use in ALL maps.

It occurs in my damage detect systems that use attached timers and attached triggers, it happens in three of my spells that use attached groups.
If you need the codes for all of the afflicted spells, I can post them up here.

To elaborate on that, it happens to me when I attach variables to timers and when I use attached groups.
In all of my tests, I've never encountered problems attaching variables to units or some such like that, all of the bugs that I get are attached groups turning up null and attached timers turning up null.
I can experiment further if it would help, I have LOTS of spells in my map that use cache and could possible isolate the problem.

Also, I find 'stressful' situations are what create this problem.
When lots of mission keys are being used and lots of variables are being cached is when they occur the most often.
Notably though, the problems seem to always occur in the above noted situations, with attached groups and timers.
07-24-2006, 08:11 PM#8
Vexorian
Actually, it is time to change the name of the bug to The freaky "variable becomes null" bug

It is seems that on intensive momments like this one, GLOBALS BECOME NULL. However if vile was using global arrays and felt safer it is strange that he didn't find the problem.

IT could be that I hit another limit, a JASS' limit and this has nothing to do with the gamecache issues you were having.

Still, that wouldn't make much sense since the reports of bugs seem to be related to the optimizer, and they are all new. I am sure that the old jass vault guys would have found this issue themselves if it was not specific to gamecache variables that become null

--

If it is not a gamecache issue we have a real problem, we would have to replace global variables with gamecache and waste all the speed accomplishments that use arrays or locations or anything it is a bad, bad thing. Really.
07-24-2006, 08:18 PM#9
iNfraNe
It seems to have to do with timers, I tried this:
Collapse JASS:
function test takes nothing returns nothing
  local integer i = GetRandomInt(0, 999999)
  local integer j = GetRandomInt(0, 999999)
  if udg_cache == null then
    call BJDebugMsg("GC NULLED!")
  endif    
  call StoreInteger(udg_cache, I2S(i), I2S(j), 2)
  if GetStoredInteger(udg_cache, I2S(i), I2S(j)) != 2 then
    call BJDebugMsg("GC FAILURE!")
  endif
endfunction

function Trig_Ha_Actions takes nothing returns nothing
  local integer i = 0
  call BJDebugMsg("Testing:")
  loop
    exitwhen i > 3000
    call ExecuteFunc("test")
    set i = i + 1
  endloop
  call BJDebugMsg("Test completed.")
endfunction
and it didnt fail.
07-24-2006, 08:21 PM#10
Vexorian
It seems to be a bug with timers and any global. And not specific to gamecache, So this is probably not the gamecache bug they were talking about .

The only way to prove this would be if they picked the map that was having the issues and make it display a warning if gamecache is found to be null.


Just:
Collapse JASS:
function hhh takes nothing returns nothing
    if (udg_gamacache==null) then

        set udg_gamacache=InitGameCache("anakonda.w3g")
        if (udg_bovar[0]==null) then
           call BJDebugMsg("WHAT?")
        endif
    endif
endfunction
 

Has the issue as well. I am gonna try replacing the gamecache var with another type.

It would be hard to think it is the same bug they are talking about otherwise vile would have found even more problems after switching to global arrays


I think we need Pipedream
07-24-2006, 08:21 PM#11
Rising_Dusk
Well I dont know what to tell you.
Ive seen reports of problems for awhile now, and it seems some reports are after opting and others before.
Notably, I think there IS a problem with the optimized code that causes it, but then you look at the code after optimization and see that it doesn't make absolute sense.

However, I don't think we can negate the possibility that a stressful period of time for cache can cause cached variables to return null.
I've seen it happen too many times for it to be coincidence and/or incompetence.

If you really want, I can screw with my trigs and add debugs around and see what it shows when it bugs out.
Let me run some tests and get some screenshots, we'll see what happens.
07-24-2006, 08:22 PM#12
Vexorian
Oh darn this was a false positive. The heavy timer initializing in the init function was crashing the thread. So the variables were never initialized
07-24-2006, 08:24 PM#13
emjlr3
yeaea im not insane

so does this mean it was something in the optimizer(thus it can easily be fixed), or did this still happen un-optimized(thus this is bad stuff)?

o poo nvm :(
07-24-2006, 08:29 PM#14
Vexorian
I have a question about this, were you having these bugs even after using optimizer 3.9d ?
07-24-2006, 08:32 PM#15
Anitarf
Ok, let's focus, so did you manage to reproduce the bug with an actualy initialized gamecache, or not? If not, then there are two threads that need big warnings edited into their first post that they are a false alarm, and there's 200 rep that needs to be subtracted from someone's repcount. :)