Selecting a specific category in the category editor causes high CPU use and database crash

Our Magento 2 site, which we migrated from Magento 1 and went live a few months ago, has generally been working fine, with one exception: I’m no longer able to make changes to one particular parent category.

When I select this parent category in the back end category editor, the following things happen:

  • the Magento admin user interface responds within a couple of seconds (the wait spinner stops spinning)
  • CPU use maxes out for about 30 seconds
  • dozens of new PHP-FPM processes are spawned
  • dozens of MariaDB database threads are spawned
  • after about 30 seconds, the mariadbd process crashes and restarts
  • at the same time, I see a ‘Something went wrong’ popup message, and red ‘technical problem with the server’ announcement, which are basically announcing that the database server has gone away

If I try again after the database restarts, the exact same thing happens.

Up until recently, I was able to get past these behaviours and add subcategories to the problem parent category. Now that’s no longer possible.

When I click on any other parent category, I see a bump in CPU use, PHP-FPM proceses, database threads, and so on. But on a much smaller scale, and only for a few seconds. And nothing crashes.

The problem category has about 450 children. The next largest parent category has about 55 children and grandchildren. So it’s possible this is just a size issue.

In the Javascript console, I see the following when I click the problem category in the category editor:

Specs:

  • Magento 2.4.7-p4
  • ElasticSearch 7.17
  • PHP 8.1
  • PHP memory limit: 2048 MB
  • MariaDB 10.6
  • Cloudways host: 8 GB memory
  • Varnish; Opcache; Memcached; Redis

I’ve tried reindexing all, and flushing all cache, which didn’t help.

The site does use several third party extensions for payment, shipping, shipping rate adjustments, custom checkout form, product import, and order export. I haven’t yet tried disabling them, but that’s near the top of the list.

We ran into a lot of issues with the migration from Magento 1, so now by default I assume any new problems we encounter are also related to the migration, but I’m not sure about this one.