[bug] Error with displaying bookmarks #577

Open
opened 2023-06-29 12:00:02 +00:00 by solidsanek · 4 comments

Your setup

OTP

Extra details

No response

Version

3.9.3-0-g9d7c877

PostgreSQL version

13.9

What were you trying to do?

I cannot access the bookmark tab, having the “Error fetching timeline: e is null” error like in this thread https://meta.akkoma.dev/t/unable-to-retrieve-more-than-20-bookmarks/449

What did you expect to happen?

The list to be displayed

What actually happened?

I believe the issue is the same as the one listed in the forum thread, where null values appear in the list of bookmarks, meaning that bookmarks were kept while the posts they reference to have been deleted.

After upgrading to the last version, 3.9.3, which should contain this fix, I tried to run once again the task to prune outdated objects database prune_objects --keep-threads, but I'm assuming that this is not retroactive, and only works on objects that are going to be deleted for the execution of this task.

A query will most likely fix it, but perhaps this can be added as a migration to make sure no one else will suffer from this problem?

Logs

No response

Severity

I can manage

Have you searched for this issue?

  • I have double-checked and have not found this issue mentioned anywhere.
### Your setup OTP ### Extra details _No response_ ### Version 3.9.3-0-g9d7c877 ### PostgreSQL version 13.9 ### What were you trying to do? I cannot access the bookmark tab, having the “Error fetching timeline: e is null” error like in this thread https://meta.akkoma.dev/t/unable-to-retrieve-more-than-20-bookmarks/449 ### What did you expect to happen? The list to be displayed ### What actually happened? I believe the issue is the same as the one listed in the forum thread, where null values appear in the list of bookmarks, meaning that bookmarks were kept while the posts they reference to have been deleted. After upgrading to the last version, 3.9.3, which should contain [this fix](https://akkoma.dev/AkkomaGang/akkoma/pulls/544), I tried to run once again the task to prune outdated objects `database prune_objects --keep-threads`, but I'm assuming that this is not retroactive, and only works on objects that are going to be deleted for the execution of this task. A query will most likely fix it, but perhaps this can be added as a migration to make sure no one else will suffer from this problem? ### Logs _No response_ ### Severity I can manage ### Have you searched for this issue? - [ ] I have double-checked and have not found this issue mentioned anywhere.
solidsanek added the
bug
label 2023-06-29 12:00:02 +00:00
Contributor

It's retro active. At the end it will delete all bookmarks that have null for an object, it doesn't matter if they were deleted on this run or not. But it only does this when --keep-threads isn't used. With --keep-threads bookmarked objects aren't deleted, so there's no need for this extra check.

I assume the problematic bookmark you have now is from a time when you ran without the --keep-threads option. If not, there must be another problem as well.

A migration indeed seems a good idea. A bug caused database inconsistencies, so a migration to fix that makes sense.

Just to fix it for now, this should fix it.

delete from public.bookmarks
where id in (
  select b.id from public.bookmarks b
  left join public.activities a on b.activity_id = a.id
  left join public.objects o on a."data" ->> 'object' = o.data ->> 'id'
  where o.id is null
)
It's retro active. At the end it will delete all bookmarks that have `null` for an object, it doesn't matter if they were deleted on this run or not. But it only does this when `--keep-threads` isn't used. With `--keep-threads` bookmarked objects aren't deleted, so there's no need for this extra check. I assume the problematic bookmark you have now is from a time when you ran without the `--keep-threads` option. If not, there must be another problem as well. A migration indeed seems a good idea. A bug caused database inconsistencies, so a migration to fix that makes sense. Just to fix it for now, this should fix it. ```sql delete from public.bookmarks where id in ( select b.id from public.bookmarks b left join public.activities a on b.activity_id = a.id left join public.objects o on a."data" ->> 'object' = o.data ->> 'id' where o.id is null ) ```
Author

Now that I read it again, I may have not explained clearly what happened:

  • Months ago, I ran the prune_objects task without this flag (I'm not even sure if this was a thing back then)
  • Recently, it was brought to my attention that bookmarks were broken
  • After updating the instance, I tried to run again the task but with --keep-threads flag, but the issue was still there
    So yeah, I was trying to explaining that the first time I ran the command, it broke certain bookmarks, and rerunning it again with this flag didn't fix it.

I'll try and run that command and report back how it went, thanks!

Now that I read it again, I may have not explained clearly what happened: - Months ago, I ran the `prune_objects` task without this flag (I'm not even sure if this was a thing back then) - Recently, it was brought to my attention that bookmarks were broken - After updating the instance, I tried to run again the task but with `--keep-threads` flag, but the issue was still there So yeah, I was trying to explaining that the first time I ran the command, it broke certain bookmarks, and rerunning it again with this flag didn't fix it. I'll try and run that command and report back how it went, thanks!

I'm having this issue as well.

I'm on 3.9.3 as of today, I also did recently do a prune+vacuum a few days ago so I can't say which was the issue

@solidsanek did the fix work for you?

Edit: Okay based on the fix that sanek linked in the OP, I ran the prune_objects task again without --keep-threads and this fixed Bookmarks in akkoma-fe and husky!

So it seems the issue sanek is having is that you added the keep threads flag when that's not prompting it to fix the bookmarks

I'm having this issue as well. I'm on 3.9.3 as of today, I also did recently do a prune+vacuum a few days ago so I can't say which was the issue @solidsanek did the fix work for you? Edit: Okay based on the fix that sanek linked in the OP, I ran the `prune_objects` task again without `--keep-threads` and this fixed Bookmarks in akkoma-fe and husky! So it seems the issue sanek is having is that you added the keep threads flag when that's not prompting it to fix the bookmarks

Just experienced this issue myself, too. Ilja's statement fixed it for me.

Just experienced this issue myself, too. Ilja's statement fixed it for me.
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: AkkomaGang/akkoma#577
No description provided.