Problem with mautic:segments:update out of memory Mautic5

Your software
My Mautic version is: v5.0.4
My PHP version is: 8.0.30
My Database type and version is: RDS MySQL 8.0.35

Your problem

I was testing the new version of Mautic 5.0.4, and whenever I try to create several segments of approximately 50k contacts, the server always ends up running out of memory. I’ve been investigating what could be causing this, and I noticed that as the mautic:segments:update process runs, the percentage of memory usage keeps increasing until the server runs out of memory. It’s an EC2 instance on AWS running with a t4g.medium (4GB RAM). What could be happening?

Steps I have tried to fix the problem:

  1. Create many contacts
  2. Create some segments
  3. Wait until process mautic:segments:update runs

Probably happening exactly what the error is stating: Out of Memory.

Increase your PHP allocated RAM to the right amount (this is specific to your setup) and it should be all good.

Can you post the .log of the server or .log of mautic?

I dont see anything in the mautic logs. The problem is not the PHP allocated Ram, the problem is that the mautic:segments:update process consume all the memory of the server.
I did the same installation that I had done with version 4, and the process never consumed that much memory in v4.

Then you probably want to trace the process.