gotosocial icon indicating copy to clipboard operation
gotosocial copied to clipboard

[bug] unable to interact (including delete) post after delete-and-redraft parent + 500 ISE

Open mirabilos opened this issue 1 year ago • 4 comments

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

I’ve written a post (in a direct message), then replied to that, then later delete-and-redraft-ed the first one.

This now leads to severe misbehaviour:

One, it’s still in my Semaphore timeline, but I cannot delete it (“404”, but the log does not show the ID of the post itself but probably the one of its now-gone parent).

Two, if I zoom on it in Semaphore, I get “internet access failed, showing offline content”.

Three, if I start a new Semaphore in a new tab, then search for the toot URL copied from the other tab, I get a 500:

timestamp="21/07/2023 00:22:39.122" func=middleware.Logger.func1.1 level=ERROR latency=28.552173ms userAgent="Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0" method=GET statusCode=500 path=/api/v2/search error="Error #01: packageStatuses: error checking visibility of status 01H5TPKZC51NA28WE3822PS62F for account 01GS55SW7VWYN3BFRYCX5NW526: isStatusVisible: error populating status 01H5TPKZC51NA28WE3822PS62F: \"error populating status parent: no entries\",\"error populating status parent: no entries\"\n" requestID=yq0d6xc90400048tbnhg msg="Internal Server Error: wrote 54B"

What's your GoToSocial Version?

0.10.0-rc3 git-f431974

GoToSocial Arch

amd64 binary

What happened?

No response

What you expected to happen?

I’m fully expecting to be able to do any and all interaction with any status I posted myself, independent of what happened to any other toot, related or not.

This includes parent being gone (deleted (redrafted or not)), parent not being visible to me any more because the parent’s author blocked or fediblocked me or I blocked or fediblocked them, or because the instance of the parent is gone or no longer reachable or suddenly serves http on the https port (don’t laugh, it happened to one (hubzilla.eu) which I saw watching the log today).

How to reproduce it?

I assume posting, replying, then deleting the first post will do.

Anything else we need to know?

No response

mirabilos avatar Jul 21 '23 00:07 mirabilos

I think I've just gotten this on my instance in similar circumstances. Actually, I think I've hit it a few times before, but I'm not sure.

I had a post with some replies, but once I delete the first post in the thread, navigating to the replies in Pinafore or even in the GTS web UI gives an error. Looking in my server's log:

timestamp="…" func=server.glob..func1.Logger.func13.1 level=ERROR latency="…" userAgent="…" method=GET statusCode=500 path=/@hikari/statuses/… clientIP=… error="Error #01: PopulateStatus: error populating status parent: sql: no rows in result set\nPopulateStatus: error populating status parent: sql: no rows in result set\n" requestID=… msg="Internal Server Error: wrote 705B"

(Some parts redacted for privacy.)

This is very annoying.

I want to say that in some previous version, restarting GoToSocial would fix this, but maybe that was a different 500 error, because it didn't work this time.

hikari-no-yume avatar Sep 15 '23 11:09 hikari-no-yume

As seen in #2363, #2058 would help with part of the problem (parent toot deleted), but maybe not other cases (parent poster blocked).

For those cases I don’t think we necessarily need thread context, just the ability to interact (reply, delete, …).

mirabilos avatar Jan 08 '24 20:01 mirabilos

Probably more of the same:

  1. I posted something (post A)
  2. I replied to it (post B)
  3. I delete-and-edit’ed post B in my client
  4. someone replied to post B (creating post C)
  5. I finished the editing, creating post B′

This results in the relationships B′←A and C←B and B no longer existing. So far, so good.

Now here the bugs:

  1. post C @-mentioned me, but it did not show up in my notifications (it did show up in the home timeline)
  2. I was unable to reply to post C (FediText returned a JSON Error; I can retry and pick out the corresponding server log if needed), very likely because GtS tried to load post B as context of post C and failed

I think these are all instances of the problem I mentioned in the OP, that GtS refuses to do things to when parts of the thread were deleted. Not quite as bad as refusing me to delete my own replies to deleted posts, but…

mirabilos avatar Mar 08 '24 22:03 mirabilos

I've been working on a patch for this issue on my instance. To avoid making affected replies completely inaccessible, PopulateStatus and GetStatusParents in internal/db/bundb/status.go can just be made to log the error and act as though there's no parent. I'd be happy to submit a PR with my changes if desired.

snowkat avatar Apr 21 '24 01:04 snowkat

I've been working on a patch for this issue on my instance. To avoid making affected replies completely inaccessible, PopulateStatus and GetStatusParents in internal/db/bundb/status.go can just be made to log the error and act as though there's no parent. I'd be happy to submit a PR with my changes if desired.

You never submitted it, right?

suoko avatar Jul 08 '24 06:07 suoko

You never submitted it, right?

Correct. I've finally submitted it at #3088

snowkat avatar Jul 09 '24 03:07 snowkat