-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Excessive memory usage in tests #5588
Comments
dbal/src/Schema/SqliteSchemaManager.php Line 252 in 9862cf0
@JABirchall the line you mentioned does what it's supposed to do, so the problem is likely caused by a combination of factors, not a single line. The DBAL's own tests run with the Could you identify an example of a single test in your suite that causes high memory usage and share it somehow? You can try running a single test with PHPUnit multiple times using the
|
Ill do some more investigating when im back at work on monday. |
same problem after upgrading to 3.4.0 |
@masoudniki Same request for you: We need a reproducer, otherwise we wouldn't know what to fix. |
@masoudniki there's no need to bump the thread with such comments: it doesn't help maintainers to reproduce the issue and doesn't help the affected users work around it. A "thumbs up" on the issue description would do the same. |
sorry for the previous comment my environment :laravel v8.83.23 im running my tests with theses settings
this is what I get after running a test with RefreshDatabaseTrait
this is the migration class which mentioned in the exception
and here what i get after running the same test for 100 time
all these exceptions get fixed after downgrading the Dbal to 3.3 |
Ive done some more investing, here is some stack traces and errors we are seeing. Single test failure
Repeated test failure memory error
Seems to be 2 issues happening here.
|
Same test on repeat after downgrade
|
@masoudniki, @JABirchall both your test suites fail due to the issue fixed in #5577. For a clean experiment, could you update the It is quite possible that the test runner used by Laravel buffers the stack traces produced by the exceptions, and en mass, this buffering causes the increase in memory usage. |
@morozov running tests without repeat
result
running tests with repeat
result
|
@masoudniki, it doesn't look like you updated the DBAL. This error was supposed to be fixed in #5577. Please follow the steps in #5584 (comment) and make sure you update the DBAL. |
An issue causing the "Undefined array key -1" error was fixed by #5597. You may want to try re-testing it with the latest |
@morozov as you said the Undefined array key -1 is fixed and my tests are passing but the memory leak still exists running a test for 1 timecommand: result:
running the same test 1000 timecommand: result:
|
@masoudniki thanks for the update. In the hindsight, the recommendation to run tests with I don't believe we can fix this problem without reproducing it first, and the problem doesn't seem to be reproducible with DBAL alone, so we need to do either of the following:
I'm open to other ideas as well. |
@morozov
and the memory starts to grow up on every call on so because I have so many tests the PHPUnit reaches the memory limit and the PHP interpreter crash the process I guess this issue can be closed |
Thanks for the confirmation, @masoudniki. As we haven't heard back from @JABirchall in a week, I'm going to close this issue. We can reopen it or get a new one filed if the issue still persists. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug Report
Laravel version: 8.73.2
Dbal version: 3.4.0
Phpunit version: 9.5.21
Summary
Durring a recent update our Laravel application, we noticed tests were failing due to trying to allocation 1.3GB in sqliteschememanager.php . this caused our build process and deployments to fail. After forcing dbal to version 3.3.8 memory usage returned to normal, around 90mb.
Current behaviour
SqliteSchemaManager.php Line 252 is causing an excessive memory usage durring unittests.
How to reproduce
Im not really sure. We have around 300 unit tests and 1000+ assertions. Most database access is mocked.
Expected behaviour
Memory usage to not be excessive
The text was updated successfully, but these errors were encountered: