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

After upgrade from 2.5.7 to >= 2.6.0 it uses a lot of memory during tests #1525

Closed
nightio opened this issue May 10, 2022 · 8 comments
Closed

Comments

@nightio
Copy link

nightio commented May 10, 2022

After upgrading from 2.5.7 to >= 2.6.0 I noticed tests fail due to out of memory (standard 128M).
In the previous version my tests used up to ~100M of memory, meanwhile, after the upgrade it needs ~400M of memory.

After a downgrade to 2.5.7, it returned to normal.

I have tested all 2.6.x versions and the result is the same. So the problem raised in version 2.6.0

Temporary fix: lock version 2.5.7 composer require doctrine/doctrine-bundle:2.5.7

@dmaicher
Copy link
Contributor

Can you provide a reproducer that shows this increased memory usage? Did not notice anything strange on my apps.

@ostrolucky
Copy link
Member

Did you upgrade only doctrine-bundle? Please make sure you only update bundle to isolate the problem.

@nightio
Copy link
Author

nightio commented May 12, 2022

@ostrolucky

Did you upgrade only doctrine-bundle? Please make sure you only update bundle to isolate the problem.

Yes, I did. I updated all packages to the newest ones and ran the tests. It turns out it uses a lot of memory. I started downgrading ONLY the doctrine/doctrine-bundle package and in version 2.5.7 it backed to normal.

@dmaicher I will try to make some examples as I find some time.

@dmaicher
Copy link
Contributor

Closing here for now. Let me know if you can provide a reproducer @nightio then we can take a look and re-open if needed.

@Kodzila
Copy link

Kodzila commented May 31, 2022

I'm experiencing the same issues. I will also look for some clues, but letting you know it's not the single project problem.

Edit: I found the issue, but it's only a side effect of change in this bundle. In 2.6.0 there was an introduction of Logger Middleware: #1429. This is fine, but it creates a bad synergy with Codeception framework plus Symfony module https://codeception.com/docs/modules/Symfony.

In the module, doctrine service is persisted between tests which effectively freezes the dependencies for Doctrine, including logger which is passed to the Driver. Logger is not cleared between tests, which makes record being accumulated and eventually leads to memory overflow.

@nightio
Copy link
Author

nightio commented May 31, 2022

@dmaicher I have prepared the repo with reproducing of this issue
https://github.com/nightio/DoctrineBundle-issues-1525

Note that the problem comes out with dama/doctrine-test-bundle in my case.
However with the same version of dama/doctrine-test-bundle but a different version of doctrine bundle problem exists or not (exists on 2.6.x but not on 2.5.7)

@dmaicher dmaicher reopened this May 31, 2022
@dmaicher
Copy link
Contributor

Thanks for the nice reproducer @nightio. I will take a closer look.

@dmaicher
Copy link
Contributor

This is actually not an issue with DoctrineBundle.

Its an issue with dama/doctrine-test-bundle instead. There is a memory leak that only shows up when using the new Doctrine DBAL logging middleware which is active since DoctrineBundle 2.6.x.

As a workaround you can disable DBAL logging in tests:

when@test:
    doctrine:
        dbal:
            logging: false

I will create a new issue on dama/doctrine-test-bundle and will try to look into fixing it there.

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

No branches or pull requests

4 participants