Thread Tools Display Modes
07-23-14, 12:55 PM   #1
Cybeloras
A Fallenroot Satyr
 
Cybeloras's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 28
Major issue with saved variables

Just discovered this after a user was reporting that some of his TellMeWhen icons were disappearing every single login/reload (http://wow.curseforge.com/addons/tel...a-few-bugs/#c3)

Something has gone wrong with the serializer for SavedVariables that is causing numbers that are totally able to be represented as integers to get turned into floats WITH ERROR.

See this shot of section of the SavedVariables that the profile is based on: http://i.imgur.com/Ts7WqCp.png

Icons 28 and 29 are the ones that get lost every single reload. There are also duplicates in there - one is the icon data that used to be there (which persisted from previous reload with a key of 28.00000000000001) and the other is the data that was corrupted to have a key of 28.00000000000001.

I will do some more testing, but so far this appears to only happen whenever an array-style table has gaps in it (as this one does at 23 and 24) which forces the values after the gap to get written with explicit keys (as it always has).

PS: If you're here from the report I submitted in-game, thanks for checking this out! Shameless plea: please also bring back the cost and powerType returns from GetSpellInfo() =)

Last edited by Cybeloras : 07-23-14 at 01:07 PM.
 
07-23-14, 12:59 PM   #2
Cybeloras
A Fallenroot Satyr
 
Cybeloras's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 28
Quick follow up: This is happening with MANY numbers, and not just table keys:

Source:
Lua Code:
  1. TMW.db.global.TEST = {[28] = "test string", [29] = 28}

Result:
Lua Code:
  1. ["TEST"] = {
  2.     [28.00000000000001] = "test string",
  3.     [29.00000000000001] = 28.00000000000001,
  4. },


Another test:
Lua Code:
  1. TMW.db.global.TEST = {}
  2. for i = 1, 200 do TMW.db.global.TEST[i] = i end

Lua Code:
  1. ["TEST"] = {
  2.     1, -- [1]
  3.     2, -- [2]
  4.     3, -- [3]
  5.     4, -- [4]
  6.     5, -- [5]
  7.     6, -- [6]
  8.     7, -- [7]
  9.     8, -- [8]
  10.     9, -- [9]
  11.     10, -- [10]
  12.     11, -- [11]
  13.     12, -- [12]
  14.     13, -- [13]
  15.     14, -- [14]
  16.     15, -- [15]
  17.     16, -- [16]
  18.     17, -- [17]
  19.     18, -- [18]
  20.     19, -- [19]
  21.     20, -- [20]
  22.     21, -- [21]
  23.     22, -- [22]
  24.     23.00000000000001, -- [23]
  25.     24.00000000000001, -- [24]
  26.     25, -- [25]
  27.     26, -- [26]
  28.     27, -- [27]
  29.     28.00000000000001, -- [28]
  30.     29.00000000000001, -- [29]
  31.     30, -- [30]
  32.     31, -- [31]
  33.     32, -- [32]
  34.     33.00000000000001, -- [33]
  35.     34.00000000000001, -- [34]
  36.     35, -- [35]
  37.     36, -- [36]
  38.     37, -- [37]
  39.     38.00000000000001, -- [38]
  40.     39.00000000000001, -- [39]
  41.     40, -- [40]
  42.     41.00000000000001, -- [41]
  43.     42, -- [42]
  44.     43, -- [43]
  45.     44.00000000000001, -- [44]
  46.     45, -- [45]
  47.     46.00000000000002, -- [46]
  48.     47, -- [47]
  49.     48.00000000000002, -- [48]
  50.     49, -- [49]
  51.     50, -- [50]
  52.     51.00000000000002, -- [51]
  53.     52, -- [52]
  54.     53.00000000000002, -- [53]
  55.     54, -- [54]
  56.     55, -- [55]
  57.     56.00000000000002, -- [56]
  58.     57, -- [57]
  59.     58.00000000000002, -- [58]
  60.     59, -- [59]
  61.     60, -- [60]
  62.     61.00000000000002, -- [61]
  63.     62, -- [62]
  64.     63.00000000000002, -- [63]
  65.     64, -- [64]
  66.     65, -- [65]
  67.     66.00000000000002, -- [66]
  68.     67, -- [67]
  69.     68.00000000000002, -- [68]
  70.     69, -- [69]
  71.     70, -- [70]
  72.     71.00000000000002, -- [71]
  73.     72, -- [72]
  74.     73.00000000000002, -- [73]
  75.     74, -- [74]
  76.     75, -- [75]
  77.     76.00000000000002, -- [76]
  78.     77, -- [77]
  79.     78.00000000000002, -- [78]
  80.     79, -- [79]
  81.     80, -- [80]
  82.     81, -- [81]
  83.     82.00000000000002, -- [82]
  84.     83.00000000000002, -- [83]
  85.     84, -- [84]
  86.     85, -- [85]
  87.     86, -- [86]
  88.     87.00000000000002, -- [87]
  89.     88.00000000000002, -- [88]
  90.     89, -- [89]
  91.     90, -- [90]
  92.     91, -- [91]
  93.     92.00000000000002, -- [92]
  94.     93, -- [93]
  95.     94, -- [94]
  96.     95, -- [95]
  97.     96.00000000000002, -- [96]
  98.     97.00000000000002, -- [97]

The rest of the 200 numbers serialized properly, but this issue isn't limited by any max - I tested up to 20,000 and 9982 was serializing wrong.

Last edited by Cybeloras : 07-23-14 at 01:17 PM.
 
07-23-14, 01:17 PM   #3
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
You might try storing the integer as a string if you need to store them out of order.
 
07-23-14, 02:15 PM   #4
Cybeloras
A Fallenroot Satyr
 
Cybeloras's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 28
The problem isn't ordering - its that numbers are straight up getting serialized wrong, and its happening no matter where the numbers are - keys and values alike are getting screwed up. Numbers that should be represented just fine as integers when stored as a double are somehow getting floating point error introduced into them. This is not like this on live servers at all.

Last edited by Cybeloras : 07-23-14 at 02:21 PM.
 
07-23-14, 07:20 PM   #5
Shirik
Blasphemer!
Premium Member
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 818
This cannot be as simple as a floating-point error, because these are IEEE 754 doubles. Every 32-bit integer (actually, every 53-bit integer) can be stored perfectly in a double-precision floating point value, which is how Lua represents numbers.

There's clearly something more insidious going on in the serialization code.
__________________
たしかにひとつのじだいがおわるのお
ぼくはこのめでみたよ
だけどつぎがじぶんおばんだってことわ
しりたくなかったんだ
It's my turn next.

Shakespeare liked regexes too!
/(bb|[^b]{2})/
 
07-24-14, 09:16 AM   #6
Nimhfree
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 267
By the way, this is only a problem with writing the saved variables out to file. In memory, the values all display correctly.
 
08-04-14, 08:03 PM   #7
Cybeloras
A Fallenroot Satyr
 
Cybeloras's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 28
Seems to be fixed in build 18663. Thanks, Blizz!
 
 

WoWInterface » Site Forums » Archived Beta Forums » WoD Beta archived threads » Major issue with saved variables

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off