Skip to content

PHP Memory limit exceeded during initialisation #130

@g-elwell

Description

@g-elwell

Describe the bug
When starting WP Cypress on a project with a lot of plugins, I have hit an issue where the PHP memory limit is exceeded, resulting in the CLI process exiting.

This appears to occur despite configuring the PHP memory limit to a higher level in cypress.config.js, ref #78.

Tracing the issue back, it appears that the memory limit of 64M defined in php.ini, is being utilised for some time prior to the memory limit defined in the config.

Therefore, increasing the memory limit in the config has no impact in some situations, although it may resolve other issues where memory is exhausted later in the process.

Also related #54

To Reproduce
This may be difficult to replicate as the specific combination of plugins in use on your project will all contribute to the memory being used.

Steps to reproduce the behavior:

  1. Create a project with many active plugins
  2. Run WP Cypress npx wp-cypress start
  3. Expect to see the PHP memory limit issue
  4. Increase PHP memory limit in cypress.config.js ref Add php memory limit to config #78
  5. Run WP Cypress npx wp-cypress start
  6. Expect to see the same PHP memory limit issue

To work around this we can:

  1. Add configFile: '/wp-cypress-config.php' to wp config in cypress.config.js
  2. Create wp-cypress.config.php with <?php ini_set('memory_limit','256M');
  3. Re-run WP Cypress
  4. Notice the memory limit has increased and initialisation issue is not hit

Expected behavior
When the PHP memory limit is increased, this should raise the limit during initialisation too.

Desktop (please complete the following information):

  • OS: MacOs
  • wp-cypress: 0.11.1
  • cypress: 10.3.0
  • cypress browser: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions