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 exhausted while running PHPUnit tests for oik on s.b/wordpress #209

Open
bobbingwide opened this issue Aug 30, 2022 · 1 comment
Open
Assignees
Labels

Comments

@bobbingwide
Copy link
Owner

bobbingwide commented Aug 30, 2022

When I PHPUnit tested oik v4.8.1 it worked fine.
Re-running the tests today I got.

PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 83395048 bytes)

The memory limit set in wp-config.php was 512M. I upped it to 1024M but still got the problem.
The trace output indicate that the memory limit had been reduced from 1024M to 256M
But I dont know where this was done.

Workaround

Turn off CLI tracing before running the PHPUnit tests.

@bobbingwide
Copy link
Owner Author

bobbingwide commented Aug 30, 2022

Explanation

  • The PHPUnit test method Tests_oik_bob_bing_wide::test_bw_wp_v0_my sets the memory limit to "256M"
  • It doesn't reset it to the original value
  • When CLI tracing is enable the trace output of the wpdb object in BW_UnitTestCase::rollback_transaction can be very large.
  • Memory is exceeded during the print_r() logic

Problem resolution

  • Find the original memory limit at the start of the test.
  • Reset the original memory limit at the end of the test.

@bobbingwide bobbingwide transferred this issue from bobbingwide/bobbingwide Aug 30, 2022
@bobbingwide bobbingwide self-assigned this Sep 5, 2022
@bobbingwide bobbingwide added the bug label Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant