humanmade / altis-cloud

Cloud Module for Altis
https://docs.altis-dxp.com/cloud/
9 stars 2 forks source link

Fix cavalcade runner memory usage leak #829

Closed joehoyle closed 7 months ago

joehoyle commented 7 months ago

We recently enabled opcache.enable_cli so Cavalcade Runner now has the opcache enabled. This is a bug, it turns out in the opcache whereby including files over and over again will lead to a memory leak. See https://github.com/php/php-src/issues/9812 for details.

This bug causes a very large memory leak in Cavalcade Runner because we naively re-init the Cloudwatchclient on every call to put_metric_data() etc.

So, it makes sense to only create the cloudwatch client once. THis should also drastically reduce the impact of the PHP bug.