[PHP] Issue with memory leak

Hello @rcorgozinho, we are using the WordPress bitnami t3large with AWS. After looking up different memory leak issues online we have set both the newrelic.transaction_tracer.max_segments_web and newrelic.transaction_tracer.max_segments_cli to 3000 segments. This helped a little bit but when a long running process happens, for instance, w3 total cache uploading wp-includes files to the CDN, this causes memory spike and takes the web server down with memory allocation issues.

It did recover after awhile and it recorded exception as follows:
E_ERROR: Out of memory (allocated 29360128) (tried to allocate 16384 bytes)
in mysqli_fetch_object called at /opt/bitnami/wordpress/wp-includes/wp-db.php (2022)
in wpdb::query called at /opt/bitnami/wordpress/wp-content/plugins/w3-total-cache/DbCache_WpdbNew.php (232)
in W3TC\DbCache_WpdbNew::default_query called at /opt/bitnami/wordpress/wp-content/plugins/w3-total-cache/DbCache_WpdbInjection.php (54)
in W3TC\DbCache_WpdbInjection::query called at /opt/bitnami/wordpress/wp-content/plugins/w3-total-cache/DbCache_WpdbNew.php (119)
in W3TC\DbCache_WpdbNew::query called at /opt/bitnami/wordpress/wp-content/plugins/w3-total-cache/DbCache_WpdbNew.php (393)
in W3TC_CallUnderlying::query called at /opt/bitnami/wordpress/wp-content/plugins/w3-total-cache/DbCache_WpdbInjection_QueryCaching.php (161)
in W3TC\DbCache_WpdbInjection_QueryCaching::query called at /opt/bitnami/wordpress/wp-content/plugins/w3-total-cache/DbCache_WpdbNew.php (119)
in W3TC\DbCache_WpdbNew::query called at /opt/bitnami/wordpress/wp-includes/wp-db.php (2695)
in wpdb::get_results called at /opt/bitnami/wordpress/wp-includes/class-wp-query.php (3034)
in WP_Query::get_posts called at /opt/bitnami/wordpress/wp-includes/class-wp-query.php (3465)
in WP_Query::query called at /opt/bitnami/wordpress/wp-includes/post.php (2153)
in get_posts called at /opt/bitnami/wordpress/wp-content/plugins/wp-user-frontend/wpuf-functions.php (213)
in wpuf_get_pages called at /opt/bitnami/wordpress/wp-content/plugins/wp-user-frontend/lib/gateway/bank.php (24)
in WPUF_Gateway_Bank::payment_options called at /opt/bitnami/wordpress/wp-includes/class-wp-hook.php (292)
in WP_Hook::apply_filters called at /opt/bitnami/wordpress/wp-includes/plugin.php (212)
in apply_filters called at /opt/bitnami/wordpress/wp-content/plugins/wp-user-frontend/admin/settings-options.php (381)
in wpuf_settings_fields called at /opt/bitnami/wordpress/wp-content/plugins/wp-user-frontend/admin/class-admin-settings.php (149)
in WPUF_Admin_Settings::get_settings_fields called at /opt/bitnami/wordpress/wp-content/plugins/wp-user-frontend/admin/class-admin-settings.php (71)
in WPUF_Admin_Settings::admin_init called at /opt/bitnami/wordpress/wp-includes/class-wp-hook.php (292)
in WP_Hook::apply_filters called at /opt/bitnami/wordpress/wp-includes/class-wp-hook.php (316)

Not sure if this would help but would really need help to explore the issue with memory leak.

Hi @dchan4

Sorry about the delay in answering you.

I can see that you had a ticket created where the verbose logs were requested.

We will be happy to investigate the memory leak if you are able to get the mentioned information.

Also, please try to install/update the PHP Agent to the latest version and check if the issue will still happen.

thanks

Rodrigo