Mastodon: Incorrect followers count (local account)

Created on 25 Jul 2019  Â·  15Comments  Â·  Source: tootsuite/mastodon

Expected behaviour

Followers count = actual number of followers

Actual behaviour

A local profile shows a low number of followers while it has in fact way more followers.

Steps to reproduce the problem

See https://mstdn.io/users/d1cor/followers. A few days ago the account showed "1 follower". Currently it shows 2 followers, while the account has 107 followers including local and foreign accounts.

Specifications

mastodon@mstdn:~/live$ git status
HEAD detached at v2.9.2
nothing to commit, working tree clean

I'm not sure if this is a bug or something is wrong with my configuration/database. Feel free to ask me to run commands in the rake console or the database.

FYI, I remember this happening for other accounts with the toot count for example.

bug

Most helpful comment

The last solution could be a "manual update" button in the account moderation UI to restore (recalculate) the actual follower count of a specific miserable user, I feel.

Edit: This seems not fully but nearly enough because it's not usual.

All 15 comments

To add information: Five days ago I gained about ~400 new followers (fake accounts) in a few seconds (from the weedis.life server). Three days later my followers account changed to zero, however I can see all my real followers list (no fake accounts). From then on I won two real followers (that's why the followers count is in two).

I suspended the weedis.life instance afterwards. Something went wrong because of this I guess.

@d1cor Exactly same thing happened to me.Now It shows 3 followers. (In reality, I have 55).

Even in my case (288 -> 0), the same phenomenon occurred in the domain block for weedis.life.
I have deleted all weedis.life accounts from within the DB, but I can not correct them.
Is there a way to recount my followers?

Same here, some local users are claiming they have 0 followers. A few days ago I did suspended weedis.life.

It is clear what is happening but not clear why. Mastodon doesn't count all records every time we need to show the count somewhere, it is hard-cached, meaning that it's a cache that's never calculated from scratch but instead incremented/decremented on updates. This cache, for some reason, sometimes becomes inaccurate.

This could be due to race conditions (two updates at the same time), but in the case of removing followers that would result in a larger-than-needed number instead of 0, so it is unclear how exactly a 0 appears.

One of the solutions I am considering is a periodic recounting, but it is a somewhat computationally expensive operation. We could better prevent race conditions by using optimistic locking, but since it is still not obvious how a 0 appears, that might not solve the root cause of the problem.

@Gargron noticed that the moderation interface is showing the right number of local users’s followers. Must be getting the value from a different place, I guess.

Confirming this on mastodon.xyz (2.9.3) after a swarm of bots spammed me with 2000 follows and I removed them in one go: My account now says I have 0 followers despite the real count being 10. New followers add to the count but old ones are completely ignored.

The last solution could be a "manual update" button in the account moderation UI to restore (recalculate) the actual follower count of a specific miserable user, I feel.

Edit: This seems not fully but nearly enough because it's not usual.

Hey, this problem is still on 2.9.3 at norden.social

Also on mstdn.io
Similar thing happened to me. I got ~450 fake accounts following me within a few seconds. I used the "Remove all followers from the selected domains" feature, in Preferences, to remove the fake followers. Immediately I did this my follower count dropped by about 900 (the 450 fake accounts plus 450 of my real followers). If I go to the Followers section of my Profile page I can see my real followers are still there. It is only the count which is wrong.

I thought it had happened because I hit the "remove (by domain)" button multiple times, while previous requests were still in flight, because I was being impatient and it took a minute to remove all the bot accounts. I had thought the cause was because I hit that button multiple times. But maybe it is due to the Moderator action instead or race condition between both? A lot was going on that day.

https://github.com/tootsuite/mastodon/pull/11597 seems the "manual" recount way.
Anyone tried this? Or it's not?

11597 seems the "manual" recount way.

Anyone tried this? Or it's not?

Yes! I had the same issues, and I ran

tootctl cache recount accounts

The affected account (@[email protected]) on my instance was updated to the correct amount of followers, but his list of followers is empty. So there's still some issues ¯\_(ツ)_/¯

FYI: after account migration the follower count is very likely to be incorrect.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

almafeta picture almafeta  Â·  3Comments

ghost picture ghost  Â·  3Comments

Lewiscowles1986 picture Lewiscowles1986  Â·  3Comments

cwebber picture cwebber  Â·  3Comments

flukejones picture flukejones  Â·  3Comments