Unable to retrieve more than 20 bookmarks

Unable to retrieve more than the 20 most-recent bookmarks. I get the following error

“Error fetching timeline: e is null”

If I delete one of the 20 bookmarks, then the next most-recent bookmark is retrieved, so it’s still in the database. Occurs on the default akkoma-fe and also some third-party clients like “Manny for Mastodon”

any logs on the backend? I tried, but don’t have this problem on my instance. I can keep fetching without problems. BE version is 3.8.0, fe version 9aa64d8.

Did not see any strange log entries. I tried deleting most of the visible bookmarks but instead of getting the earlier ones, I got this error instead:

“Error fetching timeline: null is not an object (evaluating ‘e.hasOwnProperty’)”

Sample logs when above error occurred:

Apr 25 17:26:23 akkoma-1 mix[356072]: 17:26:23.665 [warn] Rich media error for https://johnwhiles.com/posts/block-stuff: “non-existing domain”
Apr 25 17:26:29 akkoma-1 mix[356072]: 17:26:29.102 request_id=F1k9hpiWJtVhYHAAKIUh [error] Elixir.Pleroma.ReverseProxy: request to “XXXXX://hackers.town/favicon.ico” failed: “timeout”
Apr 25 17:26:29 akkoma-1 mix[356072]: 17:26:29.106 request_id=F1k9hpkJlPRu_FoAKIUx [error] Elixir.Pleroma.ReverseProxy: request to “XXXXX://hackers.town/system/media_attachments/files/110/155/805/235/229/996/original/fa1adea4133ab45c.jpeg” failed: “timeout”

This rings a bell, but I’m unsure where I saw it :thinking: Could it be that there’s a bookmark referencing a deleted post? Could you check the database if this returns results. If so, then those are bookmarks whose corresponding activities have been deleted. The question then is how that can happen :confused:

select * from public.bookmarks b 
left join public.activities a on b.activity_id = a.id
where a.id is null;

Or if that doesn’t get results, maybe try this one. Then the activity is still there, but the corresponding object isn’t any more.

select * 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;

In both cases you can delete the “broken” bookmark using the id of the bookmark (first column).

DELETE FROM public.bookmarks
WHERE id=<bookmark_id>;

If this helps, please let me know what exactly the problem was, because this may indicate there’s a bug somewhere and I’d like to see if I can track it down and fix.

The first query did not return anything, but the second one returned 43 rows in my instance. Deleting those 43 rows fixed the problem. Thanks.

Here’s two rows from the query that might help you find the issue. I’ve replaced http with XXXX since I can’t post more than 2 links. I get a lot of “Object has been deleted” entries in my logfile.

71 | 00000184-bd13-d0d5-8599-69d57a1d0000 | 00000186-64fd-657a-50a0-175ceddb0000 | 2023-02-18 17:44:49 | 2023-02-18 17:44:49 | 00000186-64fd-657a-50a0-175ceddb0000 | {“cc”: [“XXXXs://mastodon.archive.org/users/brewsterkahle/followers”, “XXXXs://mastodon.archive.org/users/internetarchive”], “to”: [“XXXXs://www.w3.org/ns/activitystreams#Public”], “bcc”: [], “bto”: [], “type”: “Create”, “actor”: “XXXXs://mastodon.archive.org/users/brewsterkahle”, “object”: “XXXXs://mastodon.archive.org/users/brewsterkahle/statuses/109886256463998110”, “context”: “tag:mastodon.archive.org,2023-02-18:objectId=345688:objectType=Conversation”} | 2023-02-18 14:46:13 | 2023-02-18 14:46:13 | f | XXXXs://mastodon.archive.org/users/brewsterkahle | {XXXXs://www.w3.org/ns/activitystreams#Public,XXXXs://mastodon.archive.org/users/brewsterkahle/followers,XXXXs://mastodon.archive.org/users/internetarchive,XXXXs://mastodon.archive.org/users/brewsterkahle} | | | |
72 | 00000184-bd13-d0d5-8599-69d57a1d0000 | 00000186-2c29-81b8-93fa-a9b739e60000 | 2023-02-20 08:51:09 | 2023-02-20 08:51:09 | 00000186-2c29-81b8-93fa-a9b739e60000 | {“cc”: [“XXXXs://hub.netzgemeinde.eu/followers/jupiter_rowland”], “to”: [“XXXXs://embers.social/profile/ada”, “XXXXs://framapiaf.org/users/peertube”, “XXXXs://pixelfed.social/users/pixelfed”, “XXXXs://social.defcon42.net/users/mirko”, “XXXXs://thias.hellqui.st/users/m”, “XXXXs://www.w3.org/ns/activitystreams#Public”], “bcc”: [], “bto”: [], “type”: “Create”, “actor”: “XXXXs://hub.netzgemeinde.eu/channel/jupiter_rowland”, “object”: “XXXXs://hub.netzgemeinde.eu/item/0a62de2a-9f79-427f-89f6-06f71dcdd485”, “context”: “XXXXs://embers.social/objects/1cdf7b7b-3163-e043-3191-6e9994226847#context”} | 2023-02-07 13:56:03 | 2023-02-07 13:56:03 | f | XXXXs://hub.netzgemeinde.eu/channel/jupiter_rowland | {XXXXs://embers.social/profile/ada,XXXXs://framapiaf.org/users/peertube,XXXXs://pixelfed.social/users/pixelfed,XXXXs://social.defcon42.net/users/mirko,XXXXs://thias.hellqui.st/users/m,XXXXs://www.w3.org/ns/activitystreams#Public,XXXXs://hub.netzgemeinde.eu/followers/jupiter_rowland,XXXXs://hub.netzgemeinde.eu/channel/jupiter_rowland} | | | |

(43 rows)

My config :pleroma, :instance, remote_post_retention_days is set to 10d.

Could this cause the issue above since remote objects would be pruned from the DB?

sry, life is getting in the way and i haven’t had much time to look into this yet :confused:

It seems you are correct! After pruning, it doesn’t clean up the bookmarks[1], while it probably should.

For now, one way to work around this, is to add the --keep-threads option to the prune task. That way threads with recent or local interaction will not be deleted. And bookmarks are also considered interaction for this purpose.

[1] https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/mix/tasks/pleroma/database.ex#L65

1 Like

PR for a fix is made :tada: #544 - Clean up bookmarks after prune_objects - akkoma - Akkoma Development

2 Likes