|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80853 Apparent memory leak in PHP 8 not present in 7.4
Submitted: 2021-03-10 19:59 UTC Modified: 2021-08-22 04:22 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: zach at yembo dot ai Assigned:
Status: No Feedback Package: Reproducible crash
PHP Version: 8.0.3 OS: Alpine Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2021-03-10 19:59 UTC] zach at yembo dot ai
Our product has an AWS SQS queue listener microservice that is an infinite loop that long polls SQS and processes messages as they come in. When using the php:7.4-fpm-alpine3.13 image from Docker Hub, the code runs indefinitely with no issues. However, when running the exact same application code using the php:8.0-fpm-alpine3.13 base image, we are seeing Kubernetes kill the pod due to exhausting the upper memory limit. 

We plotted the output of `kubectl top pods` over time, and found a long, slow climb over the course of 3-4 hours until the pod reaches the memory limit. Like many memory issues, I don't see any one smoking gun in the code. Since the 7.4 image works ok, I suspect there is a memory leak either introduced or exacerbated in PHP 8.

The codebase is fairly large and I'm not sure what particular area is causing the issue. Does anyone have ideas on how to pinpoint or where to look?

These links look generally related, but I'm not sure if there's any good way to tell if this is the same issue we are facing: 



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-03-17 10:01 UTC]
I'd usually run the program under "USE_ZEND_ALLOC=0 valgrind --tool=massif php" to get memory profile, but I'm not sure if that works well for this kind of long-running code.
 [2021-08-12 10:59 UTC]
-Status: Open +Status: Feedback
 [2021-08-12 10:59 UTC]
I don't think there's anything I can do here without more information on where the leak comes from. I'm not aware of any new leaks or pseudo-leaks introduced in PHP 8.0, so don't have any immediate suggestions on what it could be.
 [2021-08-22 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Feb 06 16:05:49 2023 UTC