bugs

Forum > Bugs > Play time..
Reply To Thread (login)
Arkuden [32]
2017-11-19 06:22:34
[6 years, 160 days ago]

I had a look at my profile today and noticed my play time is abit out of wack..

136years 35 days 3 hours and 14minutes. That's more then a life time :P


 
Miseria Cantare [34]
2017-11-19 07:49:44
[6 years, 160 days ago]

Happened to me too: http://bots4.net/profile/60839/Stop

Other known cases:

http://bots4.net/profile/31913/sirop5 http://bots4.net/profile/53943/Mister-Fantastic http://bots4.net/profile/53429/malix6

The "136 year club" as I like to call it :P


 
Ender [1]
Administrator
2017-11-19 19:33:17
[6 years, 159 days ago]

Hmm, this is a strange one. I'm kind of stumped. Let me walk through my understanding of the problem to see if this spurs any theories from the community.

As others have noted in another thread, 2^32 is 4294967296 which when interpreted as seconds, is a little over 136 years. In fact, 3 of the 6 affected bots have exactly this "played" value in the database (and the other 3 aren't far off):

mysql> select id, username, played from bots order by played desc limit 10;
+-------+----------------------+------------+
| id    | username             | played     |
+-------+----------------------+------------+
| 31913 | sirop5               | 4294967295 |
| 53429 | malix6               | 4294967295 |
| 53943 | Mister Fantastic     | 4294967295 |
| 44560 | pmmk                 | 4294961282 |
| 29634 | Cosmic               | 4294872423 |
| 53970 | Mrsmith1987          | 4294404011 |
|   174 | Lyrad                |   45123063 |
|   499 | Xerex                |   38604349 |
|   142 | TheCause             |   35537127 |
|  1542 | Eucliwood Hellscythe |   33967368 |
+-------+----------------------+------------+

Here's how "played" currently gets calculated:

  • On every page load where you're logged in, a user bookkeeping routine gets executed.
  • Among other things, this bookkeeping routine is responsible for incrementing the "played" time for your bot in the database.
  • The amount the value is incremented is determined by a function, getIncrementalPlaytimeSeconds().
  • getIncrementalPlaytimeSeconds() simply queries the database for your bot's "lastactive" value, then returns "$now - $lastactive".
  • "lastactive" is updated by the same bookkeeping routine, always setting its value to "$now".

Also worth noting that getIncrementalPlaytimeSeconds() was introduced on June 12, 2016 as part of a major refactoring of some of the oldest code in the game related to login and authentication. It caused enough subtle problems that about a month later, I made an announcement explaining what I'd done and the context in an effort to encourage folks to be on the lookout for oddities. Given that we're over 6 years into this game's lifetime and this issue just cropped up relatively recently, I'd be willing to bet kudos that the bug was introduced with that June 12, 2016 update. Before that update, most of the logic was effectively the same, with the major exception being that "lastactive" was passed around in the PHP session data instead of read from the database.

Also, my interpretation of "some values are 2^32 exactly, some are just close" is that the bug results in a very large, but not necessarily 2^32, value being returned by getIncrementalPlaytimeSeconds(). So when the bug hits, your "played" value skyrockets. When the bug doesn't hit, your value still creeps upwards like normal, eventually hitting the 2^32 cap.

So based on all this information, I think there are a few possibilities, but none of them seem likely at all, hence me being stumped. Let me know if you have any ideas!


 
Arkuden [32]
2017-11-21 21:36:26
[6 years, 157 days ago]

If you have a look at Sicrop5's profile he actually has a photo of his play time and in that photo it says the bot was built 72days ago. Now I'm saying that it was actually built back in 2013 so the bug has been around before the 2016 updates


 
Ender [1]
Administrator
2017-11-21 22:56:30
[6 years, 157 days ago]

Oh yeah, that's a great point. I agree that pretty definitively rules out the June 12, 2016 as the source of the problem. Thanks for noticing that!


 
Forum > Bugs > Play time..
Reply To Thread (login)