Big memory usage increase since Symfony 3.2 #21547

Open
gadelat opened this Issue Feb 6, 2017 · 9 comments

Projects

None yet

5 participants

@gadelat
Contributor
gadelat commented Feb 6, 2017
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.2.0

After upgrade from Symfony 3.1 to Symfony 3.2, memory usage of our phpunit tests increased from ~170MB to 3GB!

I tracked this down to this PR #19656

When we set option php_errors['log'] to false, it decreased to normal level.

We are using lot of functional tests via Symfony\Bundle\FrameworkBundle\Test::createClient

@sergeyz
sergeyz commented Feb 6, 2017

$options parameter for \Symfony\Bundle\FrameworkBundle\Test\WebTestCase::createClient should contain ['debug' => false] value

@peterrehm
Contributor

@gadelat Does this fix your issue?

@gadelat
Contributor
gadelat commented Feb 7, 2017

No it doesn't. And even if it did, it's not a proper fix.

  • I shouldn't be required to change my application code to avoid sudden memory leak in minor version upgrade, that's a regression. Setting configuration of php_errors['log'] to false in my config_test.yml is much easier.
  • I don't want to disable debug mode. Normally it doesn't have such huge performance impact. Disabling it makes test debugging harder
@nicolas-grekas
Member

just out of curiosity, does the memory usage increase or decrease when replacing https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Debug/ErrorHandler.php#L418-L436 by only $backtrace = $backtrace ?: $errorAsException->getTrace(); (keeping L419 really?)

@gadelat
Contributor
gadelat commented Feb 7, 2017

Not really @nicolas-grekas - It doesn't seem to have noticable effect.

@Jean85
Contributor
Jean85 commented Feb 22, 2017

Have you tried the latest patch, 3.2.4?

@nicolas-grekas
Member

Could also be fixed by #21061?

@gadelat
Contributor
gadelat commented Feb 22, 2017

No, it even got worse for php_errors['log'] = false after update

Symfony 3.2.3: 107.02MB. Symfony 3.2.4: 221.96MB

#21061 Doesn't help either

@gadelat
Contributor
gadelat commented Feb 26, 2017 edited

So, I found something interesting today. This bug does NOT occur when symfony/phpunit-bridge is installed

EDIT: This is what's causing to stop memory leak: https://github.com/symfony/symfony/blob/e58be70aca039a76706f6ed1e5e820cb113f4ed0/src/Symfony/Bridge/PhpUnit/bootstrap.php#L28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment