superseriousbusiness / gotosocial

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

[bug] accessing strange non-existing database column on post delete #859

Closed LittleFox94 closed 1 year ago

LittleFox94 commented 1 year ago

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

My instance (freshly upgraded to 0.5.0, working really smooth suddenly!) does not like deleting posts, failing with a really strange SQL column access - that looks like a ID? See log below:

Log ``` timestamp="28/09/2022 17:41:52.275" func=processing.(*processor).ProcessFromClientAPI level=INFO activityType=Delete objectType=Note fromAccount=littlefox model="&{ID:01GE2JK9TKH7TEZ8CHD4WZ8N0X CreatedAt:2022-09-28 17:34:03.091636 +0000 UTC UpdatedAt:2022-09-28 17:34:03.091636 +0000UTC URI:https://gotosocial-dev.svc.0x0a.network/users/littlefox/statuses/01GE2JK9TKH7TEZ8CHD4WZ8N0X URL:https://gotosocial-dev.svc.0x0a.network/@littlefox/statuses/01GE2JK9TKH7TEZ8CHD4WZ8N0X Content:

Uh, gotosocial has a 418 response? o.o

timestamp=\"28/09/2022 17:33:21.450\" func=router.loggingMiddleware.func1 level=INFO latency=401.805µs clientIP=*** userAgent= method=POST statusCode=418 path=/api/v1/apps msg=\"I'm a teapot: wrote 79B\"

AttachmentIDs:[] Attachments:[] TagIDs:[] Tags:[] MentionIDs:[] Mentions:[] EmojiIDs:[] Emojis:[] Local:0xc0017935b2 AccountID:01V566HHEZ8GJFVQPM7GD84C58 Account:0xc001197500 AccountURI:https://gotosocial-dev.svc.0x0a.network/users/littlefox InReplyToID: InReplyToURI: InReplyToAccountID: InReplyTo: InReplyToAccount: BoostOfID: BoostOfAccountID: BoostOf: BoostOfAccount: ContentWarning: Visibility:public Sensitive:0xc0017935b3 Language:EN CreatedWithApplicationID:01TNZPSN330912TYF5ZTS45PZK CreatedWithApplication: ActivityStreamsType:Note Text:Uh, gotosocial has a 418 response? o.o\n\n`timestamp=\"28/09/2022 17:33:21.450\" func=router.loggingMiddleware.func1 level=INFO latency=401.805µs clientIP=*** userAgent= method=POST statusCode=418 path=/api/v1/apps msg=\"I'm a teapot: wrote 79B\"` Pinned:0xc0017935b4 Federated:0xc0017935b5 Boostable:0xc0017935b6 Replyable:0xc0017935b7 Likeable:0xc0017935b8}" msg="processing from client" timestamp="28/09/2022 17:41:52.275" func=router.loggingMiddleware.func1 level=INFO latency=7.791567ms clientIP=2001:9e8:119f:ae01:8084:7dff:fe53:a127 userAgent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36" method=DELETE statusCode=200 path=/api/v1/statuses/01GE2JK9TKH7TEZ8CHD4WZ8N0X msg="OK: wrote 951B" timestamp="28/09/2022 17:41:52.279" func=timeline.(*timeline).Remove level=DEBUG accountTimeline=01V566HHEZ8GJFVQPM7GD84C58 statusID=01GE2JK9TKH7TEZ8CHD4WZ8N0X msg="removed 0 entries" timestamp="28/09/2022 17:41:52.280" func=concurrency.(*WorkerPool).Queue.func1 level=ERROR msg="worker.Worker[messages.FromClientAPI] ERROR: column \"01GE2JK9TKH7TEZ8CHD4WZ8N0X\" does not exist (SQLSTATE 42703)" ```

What's your GoToSocial Version?

v0.5.0

GoToSocial Arch

amd64 Docker

What happened?

Trying to delete a post, post is not deleted and a weird error is logged.

What you expected to happen?

Post to be deleted, only SQL columns used that actually exist.

How to reproduce it?

No response

Anything else we need to know?

beware: the post to be deleted contains a log entry, don't get confused by that :upside_down_face:

tsmethurst commented 1 year ago

Huh! Now that's an odd one! Thank you for bug report, will investigate this one asap

tsmethurst commented 1 year ago

btw, we use 418 for clients that haven't submitted a user-agent :D

tsmethurst commented 1 year ago

I think I might have found the cause for the bug, but I can't replicate it locally yet...

Could you possibly try building a binary from this branch and deploying it? https://github.com/superseriousbusiness/gotosocial/tree/delete_status_fix Then try deleting that same status again?

It's the same as 0.5.0, just with those two small commits (1 test and 1 possible fix)

LittleFox94 commented 1 year ago

looks good, but this build logs a whole lot more - like private keys and stuff :D

looked really close, didn't find the error and the post is now gone :)

tsmethurst commented 1 year ago

this build logs a whole lot more - like private keys and stuff

huh.... that... doesn't make a lot of sense :thinking: But I'm glad the bug is fixed!

LittleFox94 commented 1 year ago

maybe the release docker images are just built differently - had some trouble building it, maybe should tweak the Dockerfile a bit to allow for just docker build-ing it ... ^^'

NyaaaWhatsUpDoc commented 1 year ago

If you have trace logging enabled then yes I think it can include the whole query, data structures and whatnot, but I'm assuming you don't run trace logging in prod :')

I think we have a note about this in the config, but if we don't then we definitely should!

LittleFox94 commented 1 year ago

the instance is called gotosocial-dev.svc.0x0a.network - that's not prod :D still only debug logging though