Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory problem since 1.11.0 #1159

Closed
JoniJnm opened this issue May 31, 2024 · 9 comments · Fixed by #1174
Closed

Memory problem since 1.11.0 #1159

JoniJnm opened this issue May 31, 2024 · 9 comments · Fixed by #1174
Assignees
Labels
agent-php bug Something isn't working

Comments

@JoniJnm
Copy link

JoniJnm commented May 31, 2024

Hi,

I'm using a Dockerfile to run a symfony application

I'm installing APM with:

ARG APM_VERSION="v1.10.0/apm-agent-php_1.10.0_all.deb"
RUN set -e; \
    curl -s -L -o /tmp/apm-agent.deb https://github.com/elastic/apm-agent-php/releases/download/${APM_VERSION}; \
    apt install /tmp/apm-agent.deb; \
    rm -f /tmp/apm-agent.deb

All works OK, but when I upgrade to 1.11.0 I have memory problems

I can't reproduce the problem outside my project I can't share it (it's not my project, the owner is a company).

Let me share the output depending on the APM version installed and some APM config:

Installing v1.10.0/apm-agent-php_1.10.0_all.deb

CAPTURE_ERRORS OFF:

$ rm -Rf var/cache/* && ELASTIC_APM_CAPTURE_ERRORS="false" bin/console cache:warmup -n

 // Warming up the cache for the dev environment with debug false                                                       
                                                                                                                        
 [OK] Cache for the "dev" environment (debug=false) was successfully warmed.                                            
                                                                                                                        
peak memory usage (MB): 168

CAPTURE_ERRORS ON:

$ rm -Rf var/cache/* && ELASTIC_APM_CAPTURE_ERRORS="true" bin/console cache:warmup -n

 // Warming up the cache for the dev environment with debug false                                                       
                                                                                                                        
 [OK] Cache for the "dev" environment (debug=false) was successfully warmed.                                            
                                                                                                                        
peak memory usage (MB): 166

Installing v1.11.0/apm-agent-php_1.11.0_amd64.deb

CAPTURE_ERRORS OFF:

$ rm -Rf var/cache/* && ELASTIC_APM_CAPTURE_ERRORS="false" bin/console cache:warmup -n

 // Warming up the cache for the dev environment with debug false                                                       
                                                                                                                        
 [OK] Cache for the "dev" environment (debug=false) was successfully warmed.                                            
                                                                                                                        
peak memory usage (MB): 168

CAPTURE_ERRORS ON:

$ rm -Rf var/cache/* && ELASTIC_APM_CAPTURE_ERRORS="true" bin/console cache:warmup -n
PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /app/vendor/symfony/dependency-injection/Compiler/AutowireRequiredMethodsPass.php on line 76

Same problem with 1.13.0

Do you know what is happening?

Some info:

  • ubuntu 22.04
  • php 8.2

php mods enabled:

app@fd77ede50f3f:/etc/php/8.2/cli/conf.d$ ls
10-mysqlnd.ini  20-apcu.ini      20-dom.ini       20-gettext.ini   20-intl.ini       20-phar.ini      20-simplexml.ini  20-tokenizer.ini  20-yaml.ini         99-elastic-apm-custom.ini
10-opcache.ini  20-bcmath.ini    20-exif.ini      20-gmp.ini       20-mbstring.ini   20-posix.ini     20-sockets.ini    20-uuid.ini       20-zip.ini
10-pdo.ini      20-calendar.ini  20-ffi.ini       20-iconv.ini     20-mongodb.ini    20-readline.ini  20-sysvmsg.ini    20-xmlreader.ini  30-ds.ini
15-xml.ini      20-ctype.ini     20-fileinfo.ini  20-igbinary.ini  20-mysqli.ini     20-redis.ini     20-sysvsem.ini    20-xmlwriter.ini  90-company.ini
20-amqp.ini     20-curl.ini      20-ftp.ini       20-imagick.ini   20-pdo_mysql.ini  20-shmop.ini     20-sysvshm.ini    20-xsl.ini        98-elastic-apm.ini
@JoniJnm JoniJnm added the bug Something isn't working label May 31, 2024
@SebaGnich
Copy link

We have the same issue with 1.13.0 and PHP 8.3.

@JoniJnm
Copy link
Author

JoniJnm commented Jun 11, 2024

@SebaGnich does it works with 1.10.0?

@SebaGnich
Copy link

@JoniJnm With 1.10 and PHP 8.2 it worked, yes

@intuibase intuibase self-assigned this Jun 26, 2024
@intuibase
Copy link
Contributor

Steps to reproduce
set in ini:

memory_limit = 128M

run this code in cli:

for($i = 0; $i < 10000000; $i++) {
	try {
		throw new ErrorException("This is exception");
	} catch (Exception $e) {
	}
}

var_dump(memory_get_peak_usage());

v1v added a commit that referenced this issue Jul 5, 2024
…li-policy-3

* upstream/main:
  updatecli: use shared policy apm-gherkin (#1185)
  Fixed memory leak in exception handling (#1159) (#1174)
@JoniJnm
Copy link
Author

JoniJnm commented Sep 12, 2024

when you will create a new release with this fix?

@intuibase
Copy link
Contributor

intuibase commented Sep 12, 2024

Hey @JoniJnm
Did you tried latest release? The fix is included from 1.13.1
https://www.elastic.co/guide/en/apm/agent/php/master/release-notes-v1.13.1.html

Please let us know if it fixed issue for you

@JoniJnm
Copy link
Author

JoniJnm commented Sep 12, 2024

Oh, I didn't see it. Trying, thanks.

@JoniJnm
Copy link
Author

JoniJnm commented Sep 12, 2024

@intuibase
Copy link
Contributor

ah.. it's not updated, thanks for finding that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-php bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants