bugs

Forum > Bugs > Stars not contributing to plat count
Reply To Thread (login)
Myriad [405]
2019-11-21 21:32:54
[4 years, 167 days ago]

There are a number of players who have bought stars who are not having their All Star plat acknowledged: http://bots4.net/trophies/4 . There are a number of players who still have 0 plats associated with their account, despite the plat actually showing up in their trophy tally. This seems to be only affecting those players that haven't obtained any plats other than the All Star plat, however interestingly there are some that have had theirs acknowledged despite it being the only plat they've obtained. Whether the players actually received their trophy points for the stars, or their buff discounts would also be in question.


 
Ender [1]
Administrator
2019-11-21 23:00:30
[4 years, 167 days ago]

Thanks for the report. PayPal changed something some time ago and I haven't updated the game to handle it yet, so I've been assigning stars manually for awhile now. I have a checklist so that the process is consistent, but it's possible the process I'm using is missing a step vs. what used to happen automatically. I should have some time to review more closely within the next few days, so stay tuned for an update.


 
Ender [1]
Administrator
2019-11-27 00:44:38
[4 years, 162 days ago]

I ended up not yet having a chance to review this more closely and will now be traveling for a few days for Thanksgiving. Will review within the next week or so.


 
Ender [1]
Administrator
2019-12-08 21:10:33
[4 years, 150 days ago]

Sorry for the delay, just spent some time looking into this. Unfortunately, I'm having trouble convincing myself there's a problem:

  • All of the players that have recently bought stars correctly appear on the All Star trophy page under "Recently collected".
  • I ran a test in my local instance of the game where I went through my manual star assignment checklist. I confirmed that trophy points increased by 180 as expected.

Myriad, can you (or anyone else) provide a specific example of what you're seeing?


 
Myriad [405]
2019-12-08 21:31:19
[4 years, 150 days ago]

Click this link: http://bots4.net/trophies/4

On that list I count 8 players that have an empty slot in the plat column. If you open any of their profiles, the All Star plat will be listed, but their plat count is still 0


 
Boondox [373]
2019-12-09 08:38:35
[4 years, 150 days ago]

http://bots4.net/profile/70165/Prophet just one for example


 
Boondox [373]
2019-12-09 08:39:14
[4 years, 150 days ago]

Platinum (0) 2019-11-10 02:16:06 [29 days ago] platinum All Star (x10) Bought a star.


 
Ender [1]
Administrator
2019-12-09 23:08:23
[4 years, 149 days ago]

Oh right, thanks - I see what you mean now.

tl;dr: The problem isn't fixed yet. I'm not sure of the cause/scope yet. Current signs suggest this is not a new problem and has actually been a problem from day 1.

Gory details: Well this is an interesting one. I haven't gotten to the bottom of it yet. The main thing to note is that the platinum count for each bot is not calculated on the fly, but is actually a field with the number of platinums for each bot. The number gets shown in so many places, so I decided awhile back to keep an aggregated count persisted in the database separate from the individual trophy rows. Anyone that's worked with data knows the perils of this approach - if you duplicate your data, you risk running into inconsistencies (e.g. you have 3 rows in the trophy table, but then you somehow end up storing an aggregated count of 2 instead of 3).

Normally this inconsistency is avoided with database triggers (a somewhat controversial database mechanism). These triggers kick off anytime the trophies table is added to, updated, or deleted from. In theory, that should be enough to keep these totals in sync. However, that's obviously not working in certain cases. I compared raw base data to aggregated data to look for inconsistencies. I found the following:

  • Bronze, silver, and gold trophies have no inconsistencies.
  • Platinum trophies have inconsistencies for 196 bots.
  • These 196 bots all have 1 trophy in reality, but their total shows up as 0.
  • These 196 bots all have the same 1 trophy, All Star.
  • There are 197 bots that have only All Star as their platinum.
  • http://bots4.net/profile/5915 is the single bot with All Star as its only platinum that does not have the problem.
  • Very old bots are affected, i.e. this is not a new problem, e.g. http://bots4.net/profile/5925 hasn't been logged into in 8+ years and it has this problem.

So I think I'm circling in on the problem, and have some theories, but I need more time to investigate.


 
Ender [1]
Administrator
2019-12-14 18:19:22
[4 years, 144 days ago]

tl;dr: This bug is now fixed. The only impact was to the displayed platinum count and buff discount. Trophy points were unaffected.

Details below for those curious...

This ended up being a fairly insane bug. It took me a few hours to track down. I was unable to reproduce it in my local setup, even when rolling the database back to the day affected bots bought stars and then replaying their star purchases. Quite perplexing.

The problem ended up being in the end-of-month script. This is the script that runs automatically at the end of each month to decide clan winners, give out trophies, and so on. As an optimization, it disables database triggers because of the large number of trophies being given out - instead, the aforementioned inconsistencies are resolved by running a copy of the trigger at the end of the script.

The problem was the trigger copy. It wasn't an exact copy. It had a small error that the real trigger at one point had. The small error was reported and fixed way back in 2011, but unfortunately I fixed only the actual trigger, not the copy in the end-of-month script.

So yeah, this was a pretty interesting and unique bug. It doesn't take effect right away and actually repairs itself the next time you obtain any trophy (because the real trigger runs). This probably explains why it went unnoticed for over 8 years - it likely only affected inactive players. I should probably also reevaluate whether the game's use of database triggers can be replaced with something easier to reason about and less error-prone.


 
JackDingus [103]
2019-12-15 01:25:07
[4 years, 144 days ago]

good work you sexy mf


 
Esvrainzas [300]
2019-12-15 16:59:31
[4 years, 143 days ago]

Good job Ender and it's cool you explain what happened.


 
Forum > Bugs > Stars not contributing to plat count
Reply To Thread (login)