superseriousbusiness / gotosocial

Fast, fun, small ActivityPub server.
https://docs.gotosocial.org
GNU Affero General Public License v3.0
3.61k stars 304 forks source link

[bug/v0.7.0-rc3] Errors when fetching profile information #1505

Closed joelghill closed 1 year ago

joelghill commented 1 year ago

Describe the bug with a clear and concise description of what the bug is.

Running the latest release candidate and I noticed many errors are being thrown when fetching profile information fro certain users.

Error log when fetching @kim@k.iim.gay:

timestamp="14/02/2023 19:21:29.168" func=middleware.Logger.func1.1 level=INFO latency=69.914408ms clientIP=198.169.125.33 userAgent="Tusky/21.0 Android/12 OkHttp/4.10.0" method=GET statusCode=200 path=/api/v1/accounts/01GS11JTNT9E8V7X3ME7QGWXJ7/statuses msg="OK: wrote 26B"
timestamp="14/02/2023 19:21:29.170" func=typeutils.(*converter).AccountToAPIAccountPublic level=ERROR msg="AccountToAPIAccountPublic: error getting Header with id 01PD3TQ8YW9Z5762XWSXDPCQV0: no entries"
timestamp="14/02/2023 19:21:29.182" func=typeutils.(*converter).AccountToAPIAccountPublic level=ERROR msg="AccountToAPIAccountPublic: error getting Header with id 01PD3TQ8YW9Z5762XWSXDPCQV0: no entries"
timestamp="14/02/2023 19:21:29.185" func=typeutils.(*converter).AccountToAPIAccountPublic level=ERROR msg="AccountToAPIAccountPublic: error getting Header with id 01PD3TQ8YW9Z5762XWSXDPCQV0: no entries"
timestamp="14/02/2023 19:21:29.195" func=typeutils.(*converter).AccountToAPIAccountPublic level=ERROR msg="AccountToAPIAccountPublic: error getting Header with id 01PD3TQ8YW9Z5762XWSXDPCQV0: no entries"
timestamp="14/02/2023 19:21:29.196" func=typeutils.(*converter).AccountToAPIAccountPublic level=ERROR msg="AccountToAPIAccountPublic: error getting Header with id 01PD3TQ8YW9Z5762XWSXDPCQV0: no entries"
timestamp="14/02/2023 19:21:29.205" func=typeutils.(*converter).AccountToAPIAccountPublic level=ERROR msg="AccountToAPIAccountPublic: error getting Header with id 01PD3TQ8YW9Z5762XWSXDPCQV0: no entries"
timestamp="14/02/2023 19:21:29.212" func=typeutils.(*converter).AccountToAPIAccountPublic level=ERROR msg="AccountToAPIAccountPublic: error getting Header with id 01PD3TQ8YW9Z5762XWSXDPCQV0: no entries"
timestamp="14/02/2023 19:21:29.219" func=typeutils.(*converter).AccountToAPIAccountPublic level=ERROR msg="AccountToAPIAccountPublic: error getting Header with id 01PD3TQ8YW9Z5762XWSXDPCQV0: no entries"
timestamp="14/02/2023 19:21:29.226" func=typeutils.(*converter).AccountToAPIAccountPublic level=ERROR msg="AccountToAPIAccountPublic: error getting Header with id 01PD3TQ8YW9Z5762XWSXDPCQV0: no entries"
timestamp="14/02/2023 19:21:29.233" func=typeutils.(*converter).AccountToAPIAccountPublic level=ERROR msg="AccountToAPIAccountPublic: error getting Header with id 01PD3TQ8YW9Z5762XWSXDPCQV0: no entries"
timestamp="14/02/2023 19:21:29.241" func=typeutils.(*converter).AccountToAPIAccountPublic level=ERROR msg="AccountToAPIAccountPublic: error getting Header with id 01PD3TQ8YW9Z5762XWSXDPCQV0: no entries"
timestamp="14/02/2023 19:21:29.242" func=typeutils.(*converter).AccountToAPIAccountPublic level=ERROR msg="AccountToAPIAccountPublic: error getting Header with id 01PD3TQ8YW9Z5762XWSXDPCQV0: no entries"
timestamp="14/02/2023 19:21:29.255" func=typeutils.(*converter).AccountToAPIAccountPublic level=ERROR msg="AccountToAPIAccountPublic: error getting Header with id 01PD3TQ8YW9Z5762XWSXDPCQV0: no entries"

.... it goes on for a while

Only seems to occur for some accounts, but Kim stood out since I think they are running a GtS instance? I'm also seeing errors from @obi@goblin.technology (also Gts?):

timestamp="14/02/2023 19:23:28.850" func=middleware.Logger.func1.1 level=INFO latency=81.460228ms clientIP=198.169.125.33 userAgent="Tusky/21.0 Android/12 OkHttp/4.10.0" method=GET statusCode=200 path=/api/v1/accounts/01GS2SH7MJ92B7B2N6FK26PTNN/statuses msg="OK: wrote 2.00kiB"
timestamp="14/02/2023 19:23:28.852" func=bundb.(*accountDB).getAccount level=ERROR msg="error getting account 01GS11JTNT9E8V7X3ME7QGWXJ7 header: no entries"
timestamp="14/02/2023 19:23:28.855" func=bundb.(*accountDB).getAccount level=ERROR msg="error getting account 01GS11JTNT9E8V7X3ME7QGWXJ7 header: no entries"
timestamp="14/02/2023 19:23:28.862" func=bundb.(*accountDB).getAccount level=ERROR msg="error getting account 01GS11JTNT9E8V7X3ME7QGWXJ7 header: no entries"

What's your GoToSocial Version?

v0.7.0-rc3

GoToSocial Arch

amd64 binary

Browser version

All clients

What happened?

Updated to latest v0.7.0-rc3 Configured S3 to not use proxy after using proxy Ran server

What you expected to happen?

No response

How to reproduce it?

No response

Anything else we need to know?

Feel free to mark this as closed or whatever, I just wanted to point out the errors in case you were not aware of whatever is causing them.

From a user experience the only weird behavior I'm seeing is that the profile image and banner from @kim@k.iim.gay is not loading on any of my clients.

tsmethurst commented 1 year ago

Mm, I think I know what's causing this, and it's specific to rc2 (going from rc1 to rc3 this would have been avoided).

It shouldn't cause any real problems in the meantime but I'll write up some manual database commands that can be used to fix it, because it is very annoying!

tsmethurst commented 1 year ago

Alright, these steps will force your instance to refresh header + avatar for each remote account the next time your instance sees it (so, lazy refresh):

  1. Stop GtS.
  2. Open up your database and run the following SQL commands:
DELETE FROM media_attachments WHERE remote_url IS NOT NULL AND status_id IS NULL;
UPDATE accounts SET avatar_media_attachment_id=NULL WHERE domain IS NOT NULL;
UPDATE accounts SET avatar_remote_url=NULL WHERE domain IS NOT NULL;
UPDATE accounts SET header_media_attachment_id=NULL WHERE domain IS NOT NULL;
UPDATE accounts SET header_remote_url=NULL WHERE domain IS NOT NULL;
UPDATE accounts SET fetched_at=NULL;
  1. Start GtS again.

The next time your instance runs a media prune (normally every night @ midnight, but you can trigger this manually in the admin panel) it will log something like: timestamp="17/02/2023 08:39:32.278" func=media.(*manager).PruneAll.func1 level=INFO msg="pruned 11196 orphaned media" -- this indicates that all the media that was divorced by the SQL commands has been cleaned up :)

joelghill commented 1 year ago

@tsmethurst hey just following up to say this worked, thank you! Running v0.7.1 now and it smooth as butter!

tsmethurst commented 1 year ago

Glad to hear it :)