User merge failed, corrupted database entries due to third party plugin

Original title: Forum front page inaccessible (blank screen or 404)

I am moderator at the SocialHub forum at https://socialhub.activitypub.rocks which is the technology forum for the ActivityPub protocol that drives the Fediverse social realm.

Currently there is a 4-day ActivityPub Conference going on, and there has been more activity on the forum than usual. This morning I saw that the main page of the forum, when accessed directly from the URL, shows an entirely blank screen (no html returned).

However, deep links such as Spritely Project: The Super Exciting Future Of Fediverse - ActivityPub - SocialHub still work, and give access to other functionality, such as Search and the Admin panel. When clicking the logo in top-left corner, instead of the blank screen, a 404 page is shown instead.

I have notified people involved in managing the server, and maybe a server restart is all that is required. But just in case anyone recognizes this as a more serious issue, I would greatly appreciate your feedback, so that we can be up-and-running again in time before the Conference talks commence today.

PS. The forum is running v2.6.0.beta1

You might want to look at resources usage. Increased visitors meanings more resources are being used.

Increasing server resources will help with the increased visitors.

1 Like

Thanks! The server maintainers are not online yet, but I passed them this link :slight_smile:

Hi, I proceeded to upgrade to the latest version with no result, and tried to disable the Force Mobile Homepage component that we added yesterday.

Further guidance would be appreciated. I’ll look into the logs for relevant errors…

Here’s what calling the home page looks like from within the container:

Started GET "/" for 37.172.69.223 at 2020-10-04 07:32:15 +0000
Processing by CategoriesController#index as HTML
Completed 404 Not Found in 281ms (ActiveRecord: 0.0ms | Allocations: 67648)
ActiveRecord::RecordNotFound (Couldn't find all Users with 'id': (36, 50) (found 1 results, but was looking for 2).)
lib/plugin/instance.rb:259:in `public_send'
lib/plugin/instance.rb:259:in `block (2 levels) in add_to_class'
(eval):48:in `_fast_attributes'
lib/freedom_patches/ams_include_without_root.rb:57:in `include!'
app/controllers/categories_controller.rb:61:in `block (2 levels) in index'
app/controllers/categories_controller.rb:40:in `index'
app/controllers/application_controller.rb:354:in `block in with_resolved_locale'
app/controllers/application_controller.rb:354:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:68:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:336:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:22:in `call'
lib/middleware/request_tracker.rb:176:in `call'
1 Like

So, Changing the home page setting from Categories and Latest to 'Categories and Featured` gives back access to the homepage. It will have to do for now… I suspect the component interaction somehow but we’ll see. Any more insight most welcome. The show must go on :slight_smile:

1 Like

Your problem seems to be when you load the latest posts which gives an 404 error.

Did anyone change the naming of this ?

Go into settings and go look for latest and see what happens

Thank you @IAmGav for the suggestion: we have no customization for any “Latest”-related strings.

Some pages indeed remain broken, including a category which we actually need :frowning:

https://socialhub.activitypub.rocks/c/meeting/apconf2020/53

Given the code of the force mobile homepage component, I’m curious how to check whether some things have changed in the DB related to setDefaultHomepage(settings.homepage); But I don’t think it would affect a category. So there must be something else.


I just cleared the logs to ensure the current error is actually not logged. It seems like a bug with the /latest, /top, and the #meeting category. Not sure what’s happening… Looking into the logs inside the container as well for more info… Probably related to some dysfunctional post in the #meeting category…

I think the problem comes with ActiveRecord::RecordNotFound (Couldn't find all Users with 'id': (36, 50) (found 1 results, but was looking for 2).)

The ids match a user account that was merged, but the process seems to have broken…

I too think this is the problem. No expert, but guessing there is a post that references the old account that no longer exists (and it appears in Top, Latest, and the conference category). If this is the issue, executing a SQL query to delete the post, or update the User ID in it might be an option? What would be the syntax?

The merge users filter in admin actions do not show any log. I think the merge process failed somehow. @team how can I investigate and solve a failed user merger? It seems the result is good though: the user account exists with both email addresses. There must be some dangling ids in some posts somewhere…

OK, we narrowed down the issue to a single topic…

1 Like

this might help

No, it says the (source) user does not exist. I suspect the step DiscourseEvent.trigger(:merging_users, @source_user, @target_user) did not complete. Where can I find the code?

Here we go…

[39] pry(main)> PostReplyKey.where(user_id: 36)
=> [#<PostReplyKey:0x0000558954b92d68 id: 9793, user_id: 36, post_id: 3409, reply_key: "00257885-fe73-e76d-09fb-f0f708c2f032", created_at: Sat, 03 Oct 2020 19:37:20 UTC +00:00, updated_at: Sat, 03 Oct 2020 19:37:20 UTC +00:00>,
 #<PostReplyKey:0x0000558954bd6e78 id: 9120, user_id: 36, post_id: 3174, reply_key: "b726e441-1c6c-bd60-27ac-8d8d5feef3d7", created_at: Fri, 02 Oct 2020 14:21:48 UTC +00:00, updated_at: Fri, 02 Oct 2020 14:21:48 UTC +00:00>,
 #<PostReplyKey:0x0000558954bd6db0 id: 9802, user_id: 36, post_id: 3413, reply_key: "86e179a1-7516-616c-1040-c26c0539f39d", created_at: Sat, 03 Oct 2020 19:41:36 UTC +00:00, updated_at: Sat, 03 Oct 2020 19:41:36 UTC +00:00>,
 #<PostReplyKey:0x0000558954bd6ce8 id: 9821, user_id: 36, post_id: 3418, reply_key: "573f48a4-8263-4759-44f0-f6cb26b66f38", created_at: Sat, 03 Oct 2020 20:37:40 UTC +00:00, updated_at: Sat, 03 Oct 2020 20:37:40 UTC +00:00>,
 #<PostReplyKey:0x0000558954bd6c20 id: 9822, user_id: 36, post_id: 3419, reply_key: "9371479c-eeb4-1009-176d-761a854a4ddb", created_at: Sat, 03 Oct 2020 20:40:08 UTC +00:00, updated_at: Sat, 03 Oct 2020 20:40:08 UTC +00:00>,
 #<PostReplyKey:0x0000558954bd6b58 id: 9400, user_id: 36, post_id: 3245, reply_key: "e1cd57aa-a811-21f9-5e24-84439e184a8e", created_at: Fri, 02 Oct 2020 21:35:12 UTC +00:00, updated_at: Fri, 02 Oct 2020 21:35:12 UTC +00:00>,
 #<PostReplyKey:0x0000558954bd6a90 id: 8613, user_id: 36, post_id: 3067, reply_key: "407edb15-e89d-4369-9fee-1e5eab83385d", created_at: Wed, 30 Sep 2020 13:50:17 UTC +00:00, updated_at: Wed, 30 Sep 2020 13:50:17 UTC +00:00>,
 #<PostReplyKey:0x0000558954bd69c8 id: 9517, user_id: 36, post_id: 3288, reply_key: "140a48d2-1a40-d429-f6e2-2bbe37b4865d", created_at: Sat, 03 Oct 2020 09:54:40 UTC +00:00, updated_at: Sat, 03 Oct 2020 09:54:40 UTC +00:00>,
 #<PostReplyKey:0x0000558954bd6900 id: 9736, user_id: 36, post_id: 3388, reply_key: "76cacf9b-5353-0653-806d-f3c2df6689eb", created_at: Sat, 03 Oct 2020 18:37:11 UTC +00:00, updated_at: Sat, 03 Oct 2020 18:37:11 UTC +00:00>,
 #<PostReplyKey:0x0000558954bd6838 id: 8643, user_id: 36, post_id: 3011, reply_key: "6d384213-98db-652c-89eb-1979731bb311", created_at: Wed, 30 Sep 2020 20:55:31 UTC +00:00, updated_at: Wed, 30 Sep 2020 20:55:31 UTC +00:00>,
 #<PostReplyKey:0x0000558954bd6770 id: 9772, user_id: 36, post_id: 3400, reply_key: "1e9e0b2e-ecd6-3654-d0da-6e01982a890f", created_at: Sat, 03 Oct 2020 19:22:38 UTC +00:00, updated_at: Sat, 03 Oct 2020 19:22:38 UTC +00:00>]

So I tried figuring out what to do with it… Granting them to the existing user does not solve anything. Deleting them does not solve anything.

Next step: rebuild the involved topics anew, destroy the old ones, see what happens: unless anyone comes up with a better idea…

1 Like

PostReplyKey refers to the reply-to address in emails, it won’t interact with topic list rendering.

Checking the stacktrace, it’s failing inside TopicListSerializer dumping, somehow inside lib/instance/public.rb.

Try checking the topic featured users list for the old user ID (the set of avatars that shows up on the homepage).

1 Like

Hi @riking, thank you for responding… AFAIK apart from the PostReplyKey there’s no mention of this missing user id. But it might not be the actual old user id since I do not know that one. How do you think I could find it – or: what should I grep from the logs?

If it is topic featured users, this query should find it:

SELECT id
FROM topics
WHERE featured_user1 = 1234
OR featured_user2 = 1234
OR featured_user3 = 1234
OR featured_user4 = 1234
OR last_post_user_id = 1234

The query returned no result with the old userid, but one topic with the new user id, which is the topic that was already identified as problematic. I moved the topic to another category and indeed the https://socialhub.activitypub.rocks/c/meeting/apconf2020/53 category is now visible again.

Now I guess there’s a reference to the missing user_id 36 somewhere in the data related to topic 951, but I could not find it so far. Or is there another dependency I’m overlooking, wrt user 295?

Do you have a stacktrace for that error?

Nothing more than what I posted in User merge failed, corrupted database entries due to third party plugin - #4 by hellekin and commented after:

1 Like

Oh, I missed the stacktrace in User merge failed, corrupted database entries, UI troubles. So, it’s failing due to a plugin. I guess one of your plugins stored some kind of user information that hasn’t been merged. Could you give me a list of the installed plugins please?

2 Likes