502 errors when renaming large (by topic count) categories

Since I have the same issue on my development install on my home computer, I tried on my dev forum.

I tried to change the category name through Discourse interface. The error I’ve shown in my first post occured and my ram was filled up:
image

Your query shows:

I tried updating from the rails console,
Tried these two commands:

ActiveRecord::Base.connection.execute("UPDATE categories SET name = 'General Discussion', topic_template = '', sort_order = '', default_view = '', read_only_banner = '', name_lower = 'general_discussion', updated_at = '2020-09-16 13:36:50.014192' WHERE categories.id = 21")
Category.where(id: 21).update(name: "General")

Both worked like a charm.